<template>
  <div>
    <div>
      <div v-show="isShowTable">
        <el-form :inline="true" :model="formInline">
          <el-form-item label="接口名：">
            <el-input v-model="formInline.requestName"></el-input>
          </el-form-item>
          <el-form-item label="接口描述：">
            <el-input v-model="formInline.requestChName"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="getList">查询</el-button>
            <el-button type="primary" @click="handleRest">重置</el-button>
          </el-form-item>
        </el-form>
        <el-table height="700" :data="tableList" highlight-current-row>
          <el-table-column
            prop="id"
            header-align="center"
            align="center"
            label="id"
          />
          <el-table-column
            prop="projectId"
            header-align="center"
            align="center"
            label="项目id"
          />
          <el-table-column
            prop="requestChName"
            header-align="center"
            align="center"
            label="接口描述"
          />
          <el-table-column
            prop="requestName"
            header-align="center"
            align="center"
            label="接口名"
          />
          <el-table-column
            prop="requestType"
            header-align="center"
            align="center"
            label="接口请求类型"
          />
          <el-table-column
            prop="baseRequestUrl"
            header-align="center"
            align="center"
            label="接口请求地址"
          />
          <el-table-column
            header-align="center"
            align="center"
            label="接口参数"
          >
            <template slot-scope="scope">
              <div
                v-for="(item, index) in scope.row.request_Params"
                :key="index"
              >
                {{ item.paramsType }}-{{ item.paramsName }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
            prop="returnType"
            header-align="center"
            align="center"
            label="返回类型"
          />
          <el-table-column label="操作" width="120" align="center">
            <template slot-scope="scope">
              <el-button
                type="text"
                @click="handleEadit(scope.row)"
                :disabled="scope.row.isBasic == 'true'"
                :title="scope.row.isBasic == 'true' ? '原生接口不支持编辑' : ''"
                >编辑</el-button
              >
              <el-button type="text" @click="handleInterLogic(scope.row)"
                >接口逻辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div v-show="!isShowTable">
        <el-form
          ref="dialogForm"
          :model="formData"
          :rules="rules"
          v-show="isapi"
          style="padding-right: 21px"
        >
          <el-row :gutter="12">
            <el-col :span="12">
              <el-form-item prop="moduleId" label="选择子项目">
                <el-select
                  v-model="formData.moduleId"
                  placeholder="选择子项目"
                  @change="listModulePackage"
                >
                  <el-option
                    v-for="item in moduleLists"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <div
                class="grid-content bg-purple-light"
                style="margin-right: 5px"
              >
                <el-form-item prop="packageName" label="选择模块">
                  <el-select
                    v-model="formData.packageName"
                    placeholder="请选择模块"
                  >
                    <el-option
                      v-for="item in packageLists"
                      :key="item"
                      :label="item"
                      :value="item"
                    />
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple-light">
                <el-form-item prop="requestChName" label="中文名">
                  <el-input
                    v-model.trim="formData.requestChName"
                    placeholder
                    clearable
                    @input="
                      (value) =>
                        (formData.requestChName = value.replace(
                          /[^\u4e00-\u9fa5a-zA-Z]/g,
                          ''
                        ))
                    "
                  />
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div
                class="grid-content bg-purple-light"
                style="margin-right: 5px"
              >
                <el-form-item prop="requestName" label="接口名">
                  <el-input
                    v-model.trim="formData.requestName"
                    placeholder="请输入接口名，第一个字符必须是字母，后面的字符如果有必须是字母或数字"
                    clearable
                    @input="
                      (value) =>
                        (formData.requestName = value
                          ? value[0].replace(/[^a-zA-Z]/g, '') +
                            value.slice(1).replace(/[^0-9a-zA-Z]/g, '')
                          : '')
                    "
                  />
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="grid-content bg-purple">
                <el-form-item label="请求方式" required>
                  <el-select
                    v-model="formData.requestType"
                    placeholder="请选择请求方式"
                  >
                    <el-option
                      v-for="item in indexLanlists"
                      :key="item.code"
                      :label="item.label"
                      :value="item.code"
                    />
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="formData.returnType === 'List' ? 8 : 12">
              <div class="grid-content bg-purple">
                <el-form-item
                  prop="baseRequestUrl"
                  label="接口地址(例如:/customer/customer/findPage)"
                >
                  <el-input
                    v-model.trim="formData.baseRequestUrl"
                    clearable
                    placeholder="请输入接口地址例如:/customer/customer/findPage"
                  />
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="formData.returnType === 'List' ? 8 : 12">
              <div class="grid-content bg-purple">
                <el-form-item
                  label="返回参数类型"
                  prop="return_Type"
                  :rules="commonRules(leixingLists)"
                >
                  <myElAutocomplete
                    :form="formData"
                    attributeName="return_Type"
                    :seleteLists="leixingLists"
                    @inputEvent="handleReturnTypeChange"
                    valuekey="Label_Desc"
                    placeholder="请选择返回参数类型"
                  />
                </el-form-item>
              </div>
            </el-col>
            <el-col :span="8" v-if="formData.returnType === 'List'">
              <div class="grid-content bg-purple-light">
                <el-form-item
                  label="集合元素类型："
                  prop="element_Type"
                  :rules="commonRules(elementLists)"
                >
                  <myElAutocomplete
                    :form="formData"
                    attributeName="element_Type"
                    :seleteLists="elementLists"
                    @inputEvent="handleReturnElement"
                    valuekey="Label_Desc"
                    placeholder="请选择集合元素类型"
                  />
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <div style="text-align: center">
            <el-button
              type="primary"
              style="cursor: pointer"
              @click="handleAddParmes"
            >
              增加接口入参
            </el-button>
          </div>
          <div>
            <el-row
              :gutter="12"
              v-for="(item, index) in formData.requestParams"
              :key="index"
            >
              <el-col :span="12">
                <div class="grid-content bg-purple">
                  <el-form-item
                    :prop="`requestParams.${index}.paramsName`"
                    label="接收参数名称"
                    :rules="rules.paramsName"
                  >
                    <el-input
                      v-model.trim="item.paramsName"
                      clearable
                      @input="
                        (value) =>
                          (item.paramsName = value
                            ? value[0].replace(/[^a-zA-Z]/g, '') +
                              value.slice(1).replace(/[^0-9a-zA-Z]/g, '')
                            : '')
                      "
                      placeholder="请输入接收参数名称，第一个字符必须是字母，后面的字符如果有必须是字母或数字"
                    />
                  </el-form-item>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="grid-content bg-purple-light">
                  <el-form-item
                    label="类型"
                    :prop="`requestParams.${index}.params_Type`"
                    :rules="commonRules(leixingOnlyLists)"
                  >
                    <div style="position: relative">
                      <myElAutocomplete
                        :form="item"
                        attributeName="params_Type"
                        :seleteLists="leixingOnlyLists"
                        @inputEvent="(val) => handleParamsChange(val, item)"
                        valuekey="Label_Desc"
                        placeholder="请选择类型"
                      />
                      <i
                        class="el-icon-remove"
                        style="
                          font-size: 20px;
                          color: #409eff;
                          cursor: pointer;
                          position: absolute;
                          top: 24px;
                        "
                        @click="handleDelete(index)"
                      ></i>
                    </div>
                  </el-form-item>
                </div>
              </el-col>
            </el-row>
          </div>
          <el-row :gutter="12">
            <el-col :span="12">
              <div class="grid-content bg-purple-light">
                <el-form-item label="是否记录操作日志" required>
                  <el-select
                    v-model="formData.isSysLog"
                    placeholder="请选择是否记录操作日志"
                  >
                    <el-option
                      v-for="item in SysLogLists"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </div>
            </el-col>
          </el-row>
          <el-row :gutter="12">
            <el-col>
              <div
                class="grid-content bg-purple-light"
                style="text-align: center"
              >
                <el-form-item>
                  <el-button
                    type="primary"
                    style="margin-left: 8px; margin-top: 20px"
                    @click="onSave"
                    >{{ btnTitle }}</el-button
                  >
                </el-form-item>
              </div>
            </el-col>
          </el-row>
        </el-form>
        <div v-show="!isapi">
          <div>
            <el-button type="primary" @click="handleeditEdit">{{
              titleName
            }}</el-button>
            <el-button type="primary" @click="handleshowLook"
              >显示源码</el-button
            >
            <el-button type="primary" @click="handleExport">下载源码</el-button>
          </div>
          <div v-show="!isyuanmaShow">
            <div style="display: flex">
              <div style="width: 50%">
                <el-tabs
                  v-model="activeName"
                  style="flex: 1"
                  v-if="!isClicktree"
                  @tab-click="handleTabClick"
                >
                  <el-tab-pane label="控制层逻辑编辑" name="first">
                    <el-row class="isnot_Clicktree">
                      <el-col :span="24">
                        <div class="grid-content bg-purple">
                          <div style="margin: 10px 0">
                            {{ returnTesult(interfaceInformation.controller) }}
                          </div>
                          <el-button
                            type="primary"
                            @click="handleService"
                            style="margin-bottom: 10px"
                            v-show="
                              isbtn &&
                              !['VO', 'SERVICE_I', 'SCHEDULE_TASK'].includes(
                                classType
                              )
                            "
                            >引入新的服务</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleAddattribuite"
                            style="margin-bottom: 10px"
                            v-show="isbtn && !['SERVICE_I'].includes(classType)"
                            >增加全局属性</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleAddbao"
                            style="margin-bottom: 10px"
                            v-show="isbtn && !['SERVICE_I'].includes(classType)"
                          >
                            增加引入包</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleDeletebao"
                            style="margin-bottom: 10px"
                            v-show="
                              isbtn &&
                              compimport &&
                              !['SERVICE_I'].includes(classType)
                            "
                          >
                            删除引入包</el-button
                          >
                          <div>
                            <div
                              v-for="(item, index) in interfaceInformation
                                .controller.classAttribute"
                              :key="index"
                              style="padding: 5px 10px"
                            >
                              <span
                                :style="
                                  AttributeAddMethodActive(`${index}属性高亮`)
                                "
                                @click="
                                  handleActiveHighlight(
                                    `${index}属性高亮`,
                                    item
                                  )
                                "
                                >属性：{{ AttributeValueActive(item) }}</span
                              >
                              <el-button
                                type="primary"
                                v-show="isbtn"
                                @click="
                                  handleEditAttribute(
                                    item,
                                    index,
                                    `${index}属性编辑`
                                  )
                                "
                                :style="
                                  AttributeEditAddDeleteBtnStyle(
                                    `${index}属性编辑`
                                  )
                                "
                                style="margin-left: 10px"
                                >编辑</el-button
                              >
                              <el-button
                                type="primary"
                                v-show="isbtn"
                                @click="
                                  handleDeleteAttribute(
                                    item,
                                    `${index}属性删除`
                                  )
                                "
                                :style="
                                  AttributeEditAddDeleteBtnStyle(
                                    `${index}属性删除`
                                  )
                                "
                                style="margin-left: 10px"
                                >删除</el-button
                              >
                            </div>
                            <div class="elCollapseStyle">
                              <el-collapse
                                v-model="active_sName1"
                                @change="collapseChange"
                              >
                                <el-collapse-item
                                  v-for="(item, index1) in interfaceInformation
                                    .controller.methods"
                                  :key="item.id"
                                  class="mgl10"
                                  :name="`controllerMethod${item.id}`"
                                >
                                  <!-- <span
                                style="
                                  margin-bottom: 5px;
                                  margin-top: 5px;
                                  display: inline-block;
                                  margin-right: 5px;
                                "
                                v-for="(list, index) in item.annotations"
                                :key="index"
                                >{{ list }}</span
                              > -->
                                  <div
                                    slot="title"
                                    class="collapse-title"
                                    @dragenter="
                                      () =>
                                        onDragEnter(
                                          `controllerMethod${item.id}`,
                                          item.id
                                        )
                                    "
                                    @drop="() => onDragdrop(item)"
                                    @dragover="(e) => e.preventDefault()"
                                  >
                                    <div
                                      @click.stop="
                                        handlemethodsEdit(
                                          `${index1}方法高亮`,
                                          item
                                        )
                                      "
                                      :style="methodsStyle(`${index1}方法高亮`)"
                                    >
                                      <el-popover
                                        placement="right"
                                        width="400"
                                        trigger="hover"
                                        :disabled="!item.methodDesc"
                                      >
                                        <div>
                                          <div
                                            v-for="(child, index) in tooltipCom(
                                              item
                                            )"
                                            :key="index"
                                          >
                                            {{ child }}
                                          </div>
                                        </div>
                                        <div class="lipsClass" slot="reference">
                                          {{ `方法：${item.methodName}：` }}
                                          <span
                                            v-for="(
                                              item1, index2
                                            ) in item.params"
                                            :key="index2"
                                            style="margin-right: 5px"
                                            >{{ item1.paramsName }}</span
                                          >
                                        </div>
                                      </el-popover>
                                    </div>
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handleEdit3(`${index1}方法编辑`, item)
                                      "
                                      :style="BasicActive(`${index1}方法编辑`)"
                                      v-show="isbtn"
                                      >编辑</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handledelete3(`${index1}方法删除`, item)
                                      "
                                      :style="BasicActive(`${index1}方法删除`)"
                                      v-show="isbtn"
                                      >删除</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handlemMethodsClick(
                                          item,
                                          `${index1}方法实现`
                                        )
                                      "
                                      :style="
                                        AttributeAddMethodActive(
                                          `${index1}方法实现`
                                        )
                                      "
                                      v-show="
                                        isbtn && classType === 'SERVICE_I'
                                      "
                                      >查看该方法实现</el-button
                                    >
                                  </div>
                                  <draggable
                                    v-model="item.methodBody"
                                    @start="handleStart"
                                    @change="(e) => chasssnge(e, item)"
                                    @end="() => handleEnd(item)"
                                    group="items"
                                    :move="handleMove"
                                    animation="300"
                                    chosenClass="chosen"
                                  >
                                    <div
                                      v-for="(Body, index3) in item.methodBody"
                                      :key="Body.id"
                                      :style="{
                                        'margin-left':
                                          mlfone(item.methodBody, Body) + 'px',
                                        padding: '5px 0',
                                      }"
                                      v-show="!Body.showOrHiden"
                                      :obj="JSON.stringify(Body)"
                                    >
                                      <el-checkbox
                                        v-model="Body.ischecked"
                                        :disabled="Body.disa_bled"
                                        @change="
                                          (value) =>
                                            handlecheckbox(value, Body, item)
                                        "
                                        v-show="item.is_show"
                                      ></el-checkbox>
                                      <svg-icon
                                        :icon-class="iconClass(Body)"
                                        style="
                                          font-size: 12px;
                                          margin-left: 5px;
                                          margin-bottom: 1px;
                                        "
                                        v-if="addOrReduceIcon(Body)"
                                        @click.stop="
                                          handleCloseIcon(Body, item.methodBody)
                                        "
                                      />
                                      <span
                                        @click.stop="
                                          handleChildEditlight(
                                            `${Body.id}方法体高亮`,
                                            item,
                                            Body,
                                            index3,
                                            `controllerMethodBodyHighlight${Body.id}`,
                                            active_sName1
                                          )
                                        "
                                        :style="
                                          BasicActive(`${Body.id}方法体高亮`)
                                        "
                                        :class="`controllerMethodBodyHighlight${Body.id}`"
                                      >
                                        {{ BasicValue(Body) }}
                                      </span>
                                      <el-button
                                        type="primary"
                                        :style="
                                          BasicActive(`${Body.id}方法体编辑`)
                                        "
                                        @click.stop="
                                          handleChildEdit3(
                                            `${Body.id}方法体编辑`,
                                            Body,
                                            index3,
                                            item.methodBody,
                                            item,
                                            `controllerMethodBodyHighlight${Body.id}`,
                                            active_sName1
                                          )
                                        "
                                        v-show="isbtn"
                                        >编辑</el-button
                                      >
                                      <el-button
                                        type="primary"
                                        v-show="isbtn"
                                        :style="
                                          AttributeAddMethodActive(
                                            `${Body.id}方法体删除`
                                          )
                                        "
                                        @click.stop="
                                          handleClick5(
                                            index1,
                                            index3,
                                            `${Body.id}方法体删除`,
                                            Body.id,
                                            Body.methodId
                                          )
                                        "
                                        >删除</el-button
                                      >
                                      <el-button
                                        type="primary"
                                        @click.stop="handleyidong(item)"
                                        >{{ compisYidong(item) }}</el-button
                                      >
                                    </div>
                                  </draggable>
                                </el-collapse-item>
                              </el-collapse>
                            </div>
                          </div>
                        </div>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                  <el-tab-pane
                    label="服务层逻辑编辑"
                    name="second"
                    v-if="interfaceInformation.service"
                  >
                    <el-row class="isnot_Clicktree">
                      <el-col :span="24">
                        <div class="grid-content bg-purple">
                          <div style="margin: 10px 0">
                            {{ returnTesult(interfaceInformation.service) }}
                          </div>
                          <el-button
                            type="primary"
                            @click="handleService"
                            style="margin-bottom: 10px"
                            v-show="
                              isbtn &&
                              !['VO', 'SERVICE_I', 'SCHEDULE_TASK'].includes(
                                classType
                              )
                            "
                            >引入新的服务</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleAddattribuite"
                            style="margin-bottom: 10px"
                            v-show="isbtn && !['SERVICE_I'].includes(classType)"
                            >增加全局属性</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleAddbao"
                            style="margin-bottom: 10px"
                            v-show="isbtn && !['SERVICE_I'].includes(classType)"
                          >
                            增加引入包</el-button
                          >
                          <el-button
                            type="primary"
                            @click.stop="handleDeletebao"
                            style="margin-bottom: 10px"
                            v-show="
                              isbtn &&
                              compimport &&
                              !['SERVICE_I'].includes(classType)
                            "
                          >
                            删除引入包</el-button
                          >
                          <div>
                            <div
                              v-for="(item, index) in interfaceInformation
                                .service.classAttribute"
                              :key="index"
                              style="padding: 5px 10px"
                            >
                              <span
                                :style="
                                  AttributeAddMethodActive(`${index}属性高亮`)
                                "
                                @click="
                                  handleActiveHighlight(
                                    `${index}属性高亮`,
                                    item
                                  )
                                "
                                >属性：{{ AttributeValueActive(item) }}</span
                              >
                              <el-button
                                type="primary"
                                v-show="isbtn"
                                @click="
                                  handleEditAttribute(
                                    item,
                                    index,
                                    `${index}属性编辑`
                                  )
                                "
                                :style="
                                  AttributeEditAddDeleteBtnStyle(
                                    `${index}属性编辑`
                                  )
                                "
                                style="margin-left: 10px"
                                >编辑</el-button
                              >
                              <el-button
                                type="primary"
                                v-show="isbtn"
                                @click="
                                  handleDeleteAttribute(
                                    item,
                                    `${index}属性删除`
                                  )
                                "
                                :style="
                                  AttributeEditAddDeleteBtnStyle(
                                    `${index}属性删除`
                                  )
                                "
                                style="margin-left: 10px"
                                >删除</el-button
                              >
                            </div>
                            <div class="elCollapseStyle">
                              <el-collapse
                                v-model="active_sName2"
                                @change="collapseChange"
                              >
                                <el-collapse-item
                                  v-for="(item, index1) in interfaceInformation
                                    .service.methods"
                                  :key="item.id"
                                  class="mgl10"
                                  :name="`serverMethod${item.id}`"
                                >
                                  <div
                                    slot="title"
                                    class="collapse-title"
                                    @dragenter="
                                      () =>
                                        onDragEnter(
                                          `serverMethod${item.id}`,
                                          item.id
                                        )
                                    "
                                    @drop="() => onDragdrop(item)"
                                    @dragover="(e) => e.preventDefault()"
                                  >
                                    <div
                                      @click.stop="
                                        handlemethodsEdit(
                                          `${index1}方法高亮`,
                                          item
                                        )
                                      "
                                      :style="methodsStyle(`${index1}方法高亮`)"
                                    >
                                      <el-popover
                                        placement="right"
                                        width="400"
                                        trigger="hover"
                                        :disabled="!item.methodDesc"
                                      >
                                        <div>
                                          <div
                                            v-for="(child, index) in tooltipCom(
                                              item
                                            )"
                                            :key="index"
                                          >
                                            {{ child }}
                                          </div>
                                        </div>
                                        <div class="lipsClass" slot="reference">
                                          {{ `方法：${item.methodName}：` }}
                                          <span
                                            v-for="(
                                              item1, index2
                                            ) in item.params"
                                            :key="index2"
                                            style="margin-right: 5px"
                                            >{{ item1.paramsName }}</span
                                          >
                                        </div>
                                      </el-popover>
                                    </div>
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handleEdit3(`${index1}方法编辑`, item)
                                      "
                                      :style="BasicActive(`${index1}方法编辑`)"
                                      v-show="isbtn"
                                      >编辑</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handledelete3(`${index1}方法删除`, item)
                                      "
                                      :style="BasicActive(`${index1}方法删除`)"
                                      v-show="isbtn"
                                      >删除</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handlemMethodsClick(
                                          item,
                                          `${index1}方法实现`
                                        )
                                      "
                                      :style="
                                        AttributeAddMethodActive(
                                          `${index1}方法实现`
                                        )
                                      "
                                      v-show="
                                        isbtn && classType === 'SERVICE_I'
                                      "
                                      >查看该方法实现</el-button
                                    >
                                  </div>
                                  <draggable
                                    v-model="item.methodBody"
                                    @start="handleStart"
                                    @change="(e) => chasssnge(e, item)"
                                    @end="(e) => handleEnd(item)"
                                    group="items"
                                    :move="handleMove"
                                    animation="300"
                                    chosenClass="chosen"
                                  >
                                    <div
                                      v-for="(Body, index3) in item.methodBody"
                                      :key="Body.id"
                                      :style="{
                                        'margin-left':
                                          mlfone(item.methodBody, Body) + 'px',
                                        padding: '5px 0',
                                      }"
                                      v-show="!Body.showOrHiden"
                                      :obj="JSON.stringify(Body)"
                                    >
                                      <el-checkbox
                                        v-model="Body.ischecked"
                                        :disabled="Body.disa_bled"
                                        @change="
                                          (value) =>
                                            handlecheckbox(value, Body, item)
                                        "
                                        v-show="item.is_show"
                                      ></el-checkbox>
                                      <svg-icon
                                        :icon-class="iconClass(Body)"
                                        style="
                                          font-size: 12px;
                                          margin-left: 5px;
                                          margin-bottom: 1px;
                                        "
                                        v-if="addOrReduceIcon(Body)"
                                        @click.stop="
                                          handleCloseIcon(Body, item.methodBody)
                                        "
                                      />
                                      <span
                                        @click.stop="
                                          handleChildEditlight(
                                            `${Body.id}方法体高亮`,
                                            item,
                                            Body,
                                            index3,
                                            `serverMethodBodyHighlight${Body.id}`,
                                            active_sName2
                                          )
                                        "
                                        :style="
                                          BasicActive(`${Body.id}方法体高亮`)
                                        "
                                        :class="`serverMethodBodyHighlight${Body.id}`"
                                      >
                                        {{ BasicValue(Body) }}
                                      </span>
                                      <el-button
                                        type="primary"
                                        :style="
                                          BasicActive(`${Body.id}方法体编辑`)
                                        "
                                        @click.stop="
                                          handleChildEdit3(
                                            `${Body.id}方法体编辑`,
                                            Body,
                                            index3,
                                            item.methodBody,
                                            item,
                                            `serverMethodBodyHighlight${Body.id}`,
                                            active_sName2
                                          )
                                        "
                                        v-show="isbtn"
                                        >编辑</el-button
                                      >
                                      <el-button
                                        type="primary"
                                        v-show="isbtn"
                                        :style="
                                          AttributeAddMethodActive(
                                            `${Body.id}方法体删除`
                                          )
                                        "
                                        @click.stop="
                                          handleClick5(
                                            index1,
                                            index3,
                                            `${Body.id}方法体删除`,
                                            Body.id,
                                            Body.methodId
                                          )
                                        "
                                        >删除</el-button
                                      >
                                      <el-button
                                        type="primary"
                                        @click.stop="handleyidong(item)"
                                        >{{ compisYidong(item) }}</el-button
                                      >
                                    </div>
                                  </draggable>
                                </el-collapse-item>
                              </el-collapse>
                            </div>
                          </div>
                        </div>
                      </el-col>
                    </el-row>
                  </el-tab-pane>
                </el-tabs>
                <div v-loading="ClicktreeLoading">
                  <el-row class="is_Clicktree" v-if="isClicktree">
                    <el-col :span="24">
                      <div class="grid-content bg-purple">
                        <div style="margin-bottom: 10px">
                          {{ returnTesult(clicktreeInformation.controller) }}
                        </div>
                        <el-button
                          type="primary"
                          @click="handleService"
                          v-show="
                            isbtn &&
                            !['VO', 'SERVICE_I', 'SCHEDULE_TASK'].includes(
                              classType
                            )
                          "
                          >引入新的服务</el-button
                        >
                        <el-button
                          type="primary"
                          @click.stop="handleAddattribuite"
                          v-show="isbtn && !['SERVICE_I'].includes(classType)"
                          >增加全局属性</el-button
                        >
                        <el-button
                          type="primary"
                          @click.stop="handleAddbao"
                          style="margin-bottom: 10px"
                          v-show="isbtn && !['SERVICE_I'].includes(classType)"
                        >
                          增加引入包</el-button
                        >
                        <el-button
                          type="primary"
                          @click.stop="handleDeletebao"
                          style="margin-bottom: 10px"
                          v-show="
                            isbtn &&
                            compimport &&
                            !['SERVICE_I'].includes(classType)
                          "
                        >
                          删除引入包</el-button
                        >
                        <div>
                          <div
                            v-for="(item, index) in clicktreeInformation
                              .controller.classAttribute"
                            :key="index"
                            style="padding: 5px 10px"
                          >
                            <span
                              :style="
                                AttributeAddMethodActive(`${index}属性高亮`)
                              "
                              @click="
                                handleActiveHighlight(`${index}属性高亮`, item)
                              "
                              >属性：{{ AttributeValueActive(item) }}</span
                            >
                            <el-button
                              type="primary"
                              v-show="isbtn"
                              @click="
                                handleEditAttribute(
                                  item,
                                  index,
                                  `${index}属性编辑`
                                )
                              "
                              :style="
                                AttributeEditAddDeleteBtnStyle(
                                  `${index}属性编辑`
                                )
                              "
                              style="margin-left: 10px"
                              >编辑</el-button
                            >
                            <el-button
                              type="primary"
                              v-show="isbtn"
                              @click="
                                handleDeleteAttribute(item, `${index}属性删除`)
                              "
                              :style="
                                AttributeEditAddDeleteBtnStyle(
                                  `${index}属性删除`
                                )
                              "
                              >删除</el-button
                            >
                          </div>
                          <div class="elCollapseStyle">
                            <el-collapse
                              v-model="active_Name"
                              @change="collapseChange"
                            >
                              <el-collapse-item
                                v-for="(item, index1) in clicktreeInformation
                                  .controller.methods"
                                :key="item.id"
                                class="mgl10"
                                :name="`treeclick${item.id}`"
                              >
                                <template slot="title">
                                  <div
                                    class="collapse-title"
                                    @dragenter="
                                      () =>
                                        onDragEnter(
                                          `treeclick${item.id}`,
                                          item.id
                                        )
                                    "
                                    @drop="() => onDragdrop(item)"
                                    @dragover="(e) => e.preventDefault()"
                                  >
                                    <div
                                      @click="
                                        handlemethodsEdit(
                                          `${index1}方法高亮`,
                                          item
                                        )
                                      "
                                      :style="methodsStyle(`${index1}方法高亮`)"
                                    >
                                      <el-popover
                                        placement="right"
                                        width="400"
                                        trigger="hover"
                                        :disabled="!item.methodDesc"
                                      >
                                        <div>
                                          <div
                                            v-for="(child, index) in tooltipCom(
                                              item
                                            )"
                                            :key="index"
                                          >
                                            {{ child }}
                                          </div>
                                        </div>
                                        <div class="lipsClass" slot="reference">
                                          {{ `方法：${item.methodName}：` }}
                                          <span
                                            v-for="(
                                              item1, index2
                                            ) in item.params"
                                            :key="index2"
                                            style="margin-right: 5px"
                                            >{{ item1.paramsName }}</span
                                          >
                                        </div>
                                      </el-popover>
                                    </div>
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handleEdit3(`${index1}方法编辑`, item)
                                      "
                                      :style="BasicActive(`${index1}方法编辑`)"
                                      v-show="isbtn"
                                      >编辑</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handledelete3(`${index1}方法删除`, item)
                                      "
                                      :style="BasicActive(`${index1}方法删除`)"
                                      v-show="isbtn"
                                      >删除</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="
                                        handlemMethodsClick(
                                          item,
                                          `${index1}方法实现`
                                        )
                                      "
                                      :style="
                                        AttributeAddMethodActive(
                                          `${index1}方法实现`
                                        )
                                      "
                                      v-show="
                                        isbtn && classType === 'SERVICE_I'
                                      "
                                      >查看该方法实现</el-button
                                    >
                                  </div>
                                </template>

                                <draggable
                                  v-model="item.methodBody"
                                  @start="handleStart"
                                  @change="(e) => chasssnge(e, item)"
                                  @end="() => handleEnd(item)"
                                  group="items"
                                  :move="handleMove"
                                  animation="300"
                                  chosenClass="chosen"
                                >
                                  <div
                                    v-for="(Body, index3) in item.methodBody"
                                    :key="Body.id"
                                    :style="{
                                      'margin-left':
                                        mlfone(item.methodBody, Body) + 'px',
                                      padding: '5px 0',
                                    }"
                                    v-show="!Body.showOrHiden"
                                    :obj="JSON.stringify(Body)"
                                  >
                                    <el-checkbox
                                      v-model="Body.ischecked"
                                      :disabled="Body.disa_bled"
                                      @change="
                                        (value) =>
                                          handlecheckbox(value, Body, item)
                                      "
                                      v-show="item.is_show"
                                    ></el-checkbox>
                                    <svg-icon
                                      :icon-class="iconClass(Body)"
                                      style="
                                        font-size: 12px;
                                        margin-left: 5px;
                                        margin-bottom: 1px;
                                      "
                                      v-if="addOrReduceIcon(Body)"
                                      @click.stop="
                                        handleCloseIcon(Body, item.methodBody)
                                      "
                                    />

                                    <span
                                      @click.stop="
                                        handleChildEditlight(
                                          `${Body.id}方法体高亮`,
                                          item,
                                          Body,
                                          index3,
                                          `clicktreeMethodBodyHighlight${Body.id}`,
                                          active_Name
                                        )
                                      "
                                      :style="
                                        BasicActive(`${Body.id}方法体高亮`)
                                      "
                                      :class="`clicktreeMethodBodyHighlight${Body.id}`"
                                    >
                                      {{ BasicValue(Body) }}
                                    </span>
                                    <el-button
                                      type="primary"
                                      :style="
                                        BasicActive(`${Body.id}方法体编辑`)
                                      "
                                      @click.stop="
                                        handleChildEdit3(
                                          `${Body.id}方法体编辑`,
                                          Body,
                                          index3,
                                          item.methodBody,
                                          item,
                                          `clicktreeMethodBodyHighlight${Body.id}`,
                                          active_Name
                                        )
                                      "
                                      v-show="isbtn"
                                      >编辑</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      v-show="isbtn"
                                      :style="
                                        AttributeAddMethodActive(
                                          `${Body.id}方法体删除`
                                        )
                                      "
                                      @click.stop="
                                        handleClick5(
                                          index1,
                                          index3,
                                          `${Body.id}方法体删除`,
                                          Body.id,
                                          Body.methodId
                                        )
                                      "
                                      >删除</el-button
                                    >
                                    <el-button
                                      type="primary"
                                      @click.stop="handleyidong(item)"
                                      >{{ compisYidong(item) }}</el-button
                                    >
                                  </div>
                                </draggable>
                              </el-collapse-item>
                            </el-collapse>
                          </div>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </div>
              <!-- element-loading-background="rgba(0, 0, 0, 0.8)" -->
              <codemirrorvue
                :formData="someSourceCode"
                :style="{
                  marginTop: isClicktree ? '0' : '28px',
                  width: '50%',
                }"
                ref="codemirrorvue1"
                :maxHeight="
                  isClicktree ? 'calc(-204px + 100vh)' : 'calc(-232px + 100vh)'
                "
                v-loading="someLoading"
              />
            </div>
          </div>
          <div>
            <codemirrorvue
              :formData="allSourceCode"
              ref="codemirrorvue2"
              v-loading="yuanmaLoading"
              v-show="isyuanmaShow"
            />
          </div>
        </div>
      </div>
    </div>
    <describeComponent
      :diaVisible="diaVisible"
      v-if="diaVisible"
      ref="describeComponent"
    ></describeComponent>
    <describeEditComponent
      :diaVisible="diaEditVisible"
      v-if="diaEditVisible"
      ref="describeEditComponent"
    ></describeEditComponent>
    <addMethodassembly
      :diaMethodVisible="diaMethodVisible"
      v-if="diaMethodVisible"
      ref="addMethodassembly"
    />
    <el-dialog
      title="引入新的服务"
      :visible.sync="devavalugedialog"
      :before-close="handleBeforeClose"
      width="30%"
    >
      <el-form :model="serverForm" ref="sreverRef">
        <el-form-item
          prop="radioModel"
          :rules="[
            {
              type: 'array',
              required: true,
              message: '请至少选择一个服务',
              trigger: 'change',
            },
          ]"
        >
          <el-select
            v-model="serverForm.radioModel"
            clearable
            multiple
            filterable
            placeholder="请选择服务"
            style="width: 100%"
          >
            <el-option
              v-for="item in radioLists"
              :key="item.classId"
              :label="item.serviceChName"
              :value="item.serviceChName"
            >
              <el-popover
                placement="right"
                width="400"
                trigger="hover"
                :disabled="!item.classDesc"
              >
                <div>
                  <div
                    v-for="(child, index) in tooltipSeleteCom(item)"
                    :key="index"
                  >
                    {{ child }}
                  </div>
                </div>
                <div class="lipsClass" slot="reference">
                  <span style="float: left">{{ item.serviceChName }}</span>
                </div>
              </el-popover>
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="handleBeforeClose">取 消</el-button>
        <el-button type="primary" @click="handle_Sure">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="编辑全局属性"
      :visible.sync="EditAttributedialog"
      width="30%"
      v-if="EditAttributedialog"
      :before-close="handleClose"
      v-elDragDialog
    >
      <el-form :model="EditAttributeObj" ref="EditAttributeObj">
        <el-form-item
          label="类型："
          prop="type"
          :rules="[
            { required: true, message: '请选择类型', trigger: 'change' },
          ]"
        >
          <el-select
            v-model="EditAttributeObj.type"
            placeholder="请选择类型"
            @change="
              (value) =>
                value === '+' ? ($store.state.user.objServicedelog = true) : ''
            "
          >
            <el-option
              v-for="item in leixingLists"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item
          label="名字："
          prop="name"
          :rules="[{ required: true, message: '请输入名字', trigger: 'blur' }]"
        >
          <el-input v-model.trim="EditAttributeObj.name" clearable />
        </el-form-item>
        <el-form-item label="注解：" prop="annotation">
          <el-input v-model.trim="EditAttributeObj.annotation" clearable />
        </el-form-item>
        <el-form-item
          label="描述："
          prop="chName"
          :rules="[{ required: true, message: '请输入描述', trigger: 'blur' }]"
        >
          <el-input v-model.trim="EditAttributeObj.chName" clearable />
        </el-form-item>
        <el-form-item label="值：" prop="value">
          <el-input v-model.trim="EditAttributeObj.value" clearable />
          <!-- <span style="color: red"
            >当需要的是字符串类型参数时，若不是上文已经定义的属性，需要使用双引号包括。</span
          > -->
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="AttributeSave">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="添加引入包"
      :visible.sync="addbaodialog"
      width="30%"
      v-if="addbaodialog"
      v-elDragDialog
    >
      <div style="text-align: center">
        <el-button type="primary" size="mini" @click="handleaddjiahao"
          >+</el-button
        >
      </div>
      <el-form
        :model="addbaoformdialog"
        ref="addbaoformdialog"
        style="max-height: 360px; overflow-y: scroll; padding-right: 22px"
      >
        <el-form-item
          :label="`引入包${index + 1}`"
          :rules="[
            {
              required: true,
              message: `请输入参数${index + 1}`,
              trigger: 'blur',
            },
          ]"
          v-for="(item, index) in addbaoformdialog.lists"
          :prop="`lists.${index}.value`"
          :key="index"
        >
          <div style="position: relative">
            <el-input v-model.trim="item.value" clearable />
            <i
              class="el-icon-remove"
              style="
                font-size: 20px;
                color: #409eff;
                cursor: pointer;
                position: absolute;
                top: 24px;
              "
              @click="handle_Delete(index)"
            ></i>
          </div>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addbaodialog = false">取 消</el-button>
        <el-button type="primary" @click="handleSureAddbao">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="删除引入包"
      :visible.sync="deleteBaodialog"
      width="30%"
      v-if="deleteBaodialog"
      v-elDragDialog
    >
      <el-form :model="deletebaoformdialog" ref="deletebaoformdialog">
        <el-form-item
          label="引入包"
          prop="lists"
          :rules="[
            {
              required: true,
              message: `请选择引入包`,
              trigger: 'change',
            },
          ]"
        >
          <el-select
            v-model="deletebaoformdialog.lists"
            multiple
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in optionsBao"
              :key="index"
              :label="optionsBao[index]"
              :value="index"
            >
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="deleteBaodialog = false">取 消</el-button>
        <el-button type="primary" @click="handleSuredeletebao">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  GenerateInterface,
  update_generate_interface,
  requestNameExist,
  listModulePackage,
  findCanUseVo,
  findCanUseService,
  findCanUsedao,
  addClassAttribute,
  componentClassjson,
  generateClassCode,
  generateSomeClassCode,
  showServiceImpl,
  jlcpInterfaceInfo,
  projectdatebaseLists,
  deleteClassGlobalAttribute,
  updateClassGlobalAttribute,
  codeJsongenerateCode,
  findInterfaceClass,
  projectManageprojectModellist,
  deleteComponent,
  addClassImports,
  deleteClassImports,
  delete_method,
  remove_component_position,
} from "@/api/lowcode";
import codemirrorvue from "./codemirrorvue";
import objService from "./objService";
import describeComponent from "./describeComponent";
import describeEditComponent from "./describeEditComponent";
import addMethodassembly from "./addMethodassembly";
import { getToken } from "@/utils/auth";
import myElAutocomplete from "../commonComponents/myElAutocomplete.vue";
import qs from "qs";
import draggable from "vuedraggable";
export default {
  name: "basicComponents",
  components: {
    objService,
    describeComponent,
    describeEditComponent,
    addMethodassembly,
    codemirrorvue,
    myElAutocomplete,
    draggable,
  },
  data() {
    return {
      deleteBaodialog: false,
      addbaodialog: false,
      addbaoformdialog: {
        lists: [
          {
            value: "",
          },
        ],
      },
      deletebaoformdialog: {
        lists: [],
      },
      ClicktreeLoading: false, //
      yuanmaLoading: false,
      someLoading: false,
      active_sName1: [],
      active_sName2: [],
      active_Name: [], //折叠面板是否展开
      addBasicObj: {
        isMethodOrBody: "方法",
        item: null,
        isMethodObjOrBody: null,
        index3: undefined,
        className: "", //方法体选中的class的值，tab页切换用于滚动条定位
        tabActiveName: "", //方法的折叠和展开
      },
      formOldData: {},
      btnTitle: "生成接口基础信息",
      SysLogLists: [
        {
          value: "true",
          label: "是",
        },
        {
          value: "false",
          label: "否",
        },
      ],
      EditAttributedialog: false,
      EditAttributeObj: {},
      formInline: {
        requestName: "",
        requestChName: "",
        projectId: +sessionStorage.getItem("developLowCodeId"),
      },
      elementLists: [],
      isShowTable: true,
      tableList: [],
      diaEditVisible: false,
      activeIndex: undefined,
      radioLists: [],
      devavalugedialog: false,
      classType: "",
      diaMethodVisible: false,
      packageLists: [],
      titleName: "编辑此类",
      isbtn: false,
      isapi: true,
      isClicktree: false,
      isContains: [1, 2, 3, 16, 17],
      isdbcaozuozujian: [8, 9, 14], //打断循环，结束循环，返回组件
      interfaceInformation: {
        controller: {
          classAttribute: [
            //登录服务
            {
              annotation: "",
              accessModifier: "",
              type: "",
              name: "",
              chName: "",
            },
          ],
          methods: [],
        },
        service: {
          classAttribute: [],
          methods: [],
        },
      },
      clicktreeInformation: {
        controller: {
          classAttribute: [],
          methods: [],
        },
      },
      clicktree_Information: {
        controller: {
          classAttribute: [],
          methods: [],
        },
      },
      interface_Information: {
        controller: {},
        service: {},
      },
      leixingLists: [],
      disoyongResultLists: [],
      leixingOnlyLists: [],
      formData: {
        packageName: "",
        requestChName: "",
        requestName: "",
        requestType: "get",
        baseRequestUrl: "",
        returnType: "String",
        return_Type: "String | 字符串",
        requestParams: [
          {
            paramsName: "",
            paramsType: "String",
            params_Type: "String | 字符串",
          },
        ],
        isSysLog: "true",
        moduleId: "",
      },
      moduleLists: [],
      rules: {
        moduleId: [
          {
            required: true,
            message: "选择子项目",
            trigger: "change",
          },
        ],
        packageName: [
          { required: true, message: "请选择模块", trigger: "change" },
        ],
        requestChName: [
          { required: true, message: "请输入中文名", trigger: "blur" },
        ],
        requestName: [
          {
            required: true,
            message:
              "请输入接口名，第一个字符必须是字母，后面的字符如果有必须是字母或数字",
            trigger: "blur",
          },
        ],
        baseRequestUrl: [
          {
            required: true,
            message:
              "请输入接口地址，第一个字符必须是字母，后面的字符如果有必须是字母或数字",
            trigger: "blur",
          },
        ],
        paramsName: [
          {
            required: true,
            message:
              "请输入接收参数名称，第一个字符必须是字母，后面的字符如果有必须是字母或数字",
            trigger: "blur",
          },
        ],
        returnClassName: [
          { required: true, message: "返回参数类名不能为空", trigger: "blur" },
        ],
        paramsClassName: [
          { required: true, message: "类名不能为空", trigger: "blur" },
        ],
      },
      indexLanlists: [
        {
          code: "get",
          label: "get",
        },
        {
          code: "post",
          label: "post",
        },
      ],
      diaVisible: false,
      activeName: "first",
      commonParmes: {},
      typeIndex: undefined,
      serverForm: {
        radioModel: [],
      },
      isyuanmaShow: false,
      allSourceCode: { content: "" },
      someSourceCode: { content: "" },
      activeObj: {},
      create_InstanceClassLists: [],
      addMethodReturnType: [],
      dragEndLists: [], //拖拽之后的新的数组集合
      dragCurrentandTargetidx: {},
      DragEnterid: "",
      Dragleaveid: "",
      startObj: null,
    };
  },
  computed: {
    tooltipSeleteCom() {
      return (item) => {
        return item.classDesc?.split("\r\n") ?? [];
      };
    },
    tooltipCom() {
      return (item) => {
        return item.methodDesc?.split("\r\n") ?? [];
      };
    },
    optionsBao() {
      if (this.isClicktree) {
        return this.clicktreeInformation.controller.imports;
      } else {
        if (this.activeName === "first") {
          return this.interfaceInformation.controller.imports;
        } else {
          return this.interfaceInformation.service.imports;
        }
      }
    },
    compimport() {
      if (this.isClicktree) {
        return this.clicktreeInformation.controller.imports?.length;
      } else {
        if (this.activeName === "first") {
          return this.interfaceInformation.controller.imports?.length;
        } else {
          return this.interfaceInformation.service?.imports?.length;
        }
      }
    },
    // ClicktreeStyle() {
    //   let heights = "";
    //   if (this.titleName === "查看此类") {
    //     if (this.isClicktree) {
    //       heights = "calc(100vh - 269px)";
    //     } else {
    //       heights = "calc(100vh - 335px)";
    //     }
    //   } else {
    //     if (this.isClicktree) {
    //       heights = "calc(100vh - 241px)";
    //     } else {
    //       heights = "calc(100vh - 297px)";
    //     }
    //   }
    //   return {
    //     height: heights,
    //     "overflow-y": "auto",
    //     "overflow-x": "hidden",
    //   };
    // },
    mlfone() {
      return (lists, list) => {
        const obj = lists.find((item2) => item2.id === list.parentId);
        if (obj) {
          if (this.isContains.includes(obj.componentType)) {
            if (obj.num) {
              list.num = obj.num + 1;
              return (obj.num + 1) * 27;
            } else {
              list.num = 2;
              return 2 * 27;
            }
          } else {
            return "27";
          }
        } else {
          return "27";
        }
      };
    },
    isShow() {
      return (lists, list) => {
        const obj = lists.find((item2) => item2.id === list.parentId);
        if (obj) {
          if (this.isContains.includes(obj.componentType)) {
            return true;
          } else {
            return false;
          }
        } else {
          return false;
        }
      };
    },
    returnTesult() {
      return (obj) => {
        if (obj) {
          let str = obj.implementsJson?.length ? " 实现：" : "";
          obj.implementsJson?.forEach((item) => {
            str += `${item} `;
          });
          let classDesc = obj.classDesc ? ` ${obj.classDesc}` : "";
          let extendsss = obj.extendsJson ? ` 继承：${obj.extendsJson}` : "";
          return `${
            obj.className ? obj.className : ""
          }${classDesc}${extendsss}${str}`;
        }
      };
    },
    showComPonentName() {
      return (Body) => {
        return [1, 16, 17].includes(Body.componentType)
          ? "条件判断"
          : [2, 3].includes(Body.componentType)
          ? "循环控制"
          : Body.componentType == 5
          ? "调用方法"
          : Body.componentType == 4
          ? "创建属性"
          : Body.componentType == 14
          ? "返回组件"
          : Body.componentType == 7
          ? "创建实例组件"
          : Body.componentType == 8
          ? "结束循环组件"
          : Body.componentType == 9
          ? "打断当前循环组件"
          : // : [18, 19, 20, 21].includes(Body.componentType)
          // ? "数据库操作组件"
          Body.componentType == 18
          ? "查询"
          : Body.componentType == 19
          ? "更新"
          : Body.componentType == 20
          ? "删除"
          : Body.componentType == 21
          ? "SQL"
          : Body.componentType == 22
          ? "实例赋值组件"
          : Body.componentType == 23
          ? "集合元素添加组件"
          : Body.componentType == 24 && Body.paramsJson.filterType == "1"
          ? "按集合下标获取元素"
          : Body.componentType == 24 && Body.paramsJson.filterType == "2"
          ? "按条件筛选元素"
          : Body.componentType == 25 && Body.paramsJson.filterType == "1"
          ? "按集合下标删除"
          : Body.componentType == 25 && Body.paramsJson.filterType == "2"
          ? "按条件筛选删除"
          : Body.componentType == 26
          ? Body.paramsJson.calculateType === "BASIC"
            ? "基础运算"
            : Body.paramsJson.calculateType === "HIGH_LEVEL"
            ? "高阶运算"
            : "数值格式化"
          : Body.componentType == 27
          ? Body.paramsJson.operateType === "TRANS"
            ? "格式转换"
            : Body.paramsJson.operateType === "DATE"
            ? "日期运算"
            : "日期/时间比较"
          : Body.componentType == 28
          ? "控制台日志"
          : Body.componentType == 29
          ? "自定义代码段"
          : Body.componentType == 30
          ? "字符串操作"
          : Body.componentType == 31
          ? "短信通知"
          : Body.componentType == 32
          ? "邮件通知"
          : Body.componentType == 33
          ? "一次性定时任务"
          : Body.componentType == 34
          ? "字符串拼接"
          : Body.componentType == 35
          ? "HTTP请求"
          : Body.componentType == 36
          ? "feign调用"
          : Body.componentType == 37
          ? "创建集合"
          : "";
      };
    },
    BasicValue() {
      return (Body) => {
        return this.showComPonentName(Body) === "创建属性"
          ? `${this.showComPonentName(Body)}：${
              Body.paramsJson.propertyType
            } - ${Body.paramsJson.propertyName} | ${Body.componentDesc}`
          : `${this.showComPonentName(Body)}：${Body.componentDesc}`;
      };
    },
    AttributeValueActive() {
      return (item) => {
        return `${item.type} - ${item.name} | ${
          item.chName ? item.chName : item.name
        }`;
      };
    },
    methodsStyle() {
      return (index) => {
        let widthStr = "";
        if (this.titleName == "查看此类") {
          if (this.classType === "SERVICE_I") {
            widthStr = "56%";
          } else {
            widthStr = "75%";
          }
        } else {
          widthStr = "100%";
        }
        return {
          color: this.activeIndex === index ? "#ffba00" : "",
          cursor: "pointer",
          "max-width": widthStr,
        };
      };
    },
    AttributeAddMethodActive() {
      return (index) => {
        return {
          color: this.activeIndex === index ? "#ffba00" : "",
          cursor: "pointer",
        };
      };
    },
    AttributeEditAddDeleteBtnStyle() {
      return (index) => {
        return {
          color: this.activeIndex === index ? "#ffba00" : "#fff",
          marginLeft: "10px",
        };
      };
    },
    BasicActive() {
      return (index) => {
        return {
          "margin-right": "5px",
          color: this.activeIndex === index ? "#ffba00" : "",
          cursor: "pointer",
        };
      };
    },
    computedTreeOrfalse() {
      return {
        isShowTable: this.isShowTable,
        isapi: this.isapi,
        isyuanmaShow: this.isyuanmaShow,
      };
    },
    iscomputedShow() {
      return (Body) => {
        if (Body.childrenIds && [1, 16, 17].includes(Body.componentType)) {
          Body.ifAddElse = "closeSvg";
          return true;
        } else {
          return false;
        }
      };
    },
    iconClass() {
      return (Body) => {
        if (Body.ifAddElse) {
          return Body.ifAddElse;
        } else {
          this.$set(Body, "ifAddElse", "closeSvg");
          return "closeSvg";
        }
      };
    },
    addOrReduceIcon() {
      return (Body) => {
        const childrenIds = Body.childrenIds
          ? JSON.parse(Body.childrenIds).length
          : false;
        if (childrenIds && [1, 16, 17].includes(Body.componentType)) {
          return true;
        } else {
          return false;
        }
      };
    },
    compisYidong() {
      return (item) => {
        if (item.yidongordelete) {
          return item.yidongordelete;
        } else {
          this.$set(item, "yidongordelete", "移动");
          this.$set(item, "checkids", []);
          this.$set(item, "is_show", false);
          item.methodBody.forEach((list) => {
            this.$set(list, "ischecked", false);
            this.$set(list, "disa_bled", false);
          });
          return "移动";
        }
      };
    },
  },
  watch: {
    computedTreeOrfalse: {
      handler(newVal) {
        if (!newVal.isShowTable && !newVal.isyuanmaShow && !newVal.isapi) {
          this.$parent.$parent.$parent.$parent.handleadFangfaAdd("addfangfa");
        } else {
          this.$parent.$parent.$parent.$parent.handleadFangfaDelete(
            "addfangfa"
          );
        }
      },
      deep: true,
    },
  },
  destroyed() {
    this.$parent.$parent.$parent.$parent.handleadFangfaDelete("addfangfa");
  },
  async created() {
    this.findAllCanUseVo();
    this.getList();
    this.projectManageprojectModellist();
  },
  methods: {
    shpakege(childrenIds, methodBody, flag) {
      const lists = JSON.parse(childrenIds);
      lists.forEach((id) => {
        const obj = methodBody.find((v) => v.id == id);
        if (obj) {
          this.$set(obj, "showOrHiden", flag);
        }
        if (obj.childrenIds && obj.ifAddElse == "closeSvg") {
          this.shpakege(obj.childrenIds, methodBody, flag);
        }
      });
    },
    handleCloseIcon(Body, methodBody) {
      if (Body.ifAddElse == "closeSvg") {
        Body.ifAddElse = "openSvg";
        this.shpakege(Body.childrenIds, methodBody, true);
      } else {
        Body.ifAddElse = "closeSvg";
        this.shpakege(Body.childrenIds, methodBody, false);
      }
    },
    handleStart(e) {
      this.startObj = JSON.parse(e.item.getAttribute("obj"));
      console.log(this.startObj, "handleStart");
    },
    chasssnge(e, item) {
      console.log(e, item, "chasssnge11");
      if ("moved" in e) {
        this.dragCurrentandTargetidx = {
          newIndex: e.moved.newIndex,
          currentObj: e.moved.element,
          id: item.id,
        };
      } else {
        if ("added" in e) {
          this.dragCurrentandTargetidx = {
            newIndex: e.added.newIndex,
            currentObj: e.added.element,
            id: item.id,
            added: true,
          };
        }
      }
    },
    handleMove(e) {
      //任何组件移到返回组件和结束循环组件的下面都是不允许的
      if (
        e.relatedContext.element?.componentType == 14 ||
        e.relatedContext.element?.componentType == 8
      ) {
        return false;
      }
      return true;
    },
    onDragEnter(id, saveid) {
      console.log(saveid, "onDragEnter");
      this.DragEnterid = saveid;
      if (this.isClicktree) {
        if (!this.active_Name.includes(id)) {
          this.active_Name.push(id);
        }
      } else {
        if (this.activeName === "first") {
          if (!this.active_sName1.includes(id)) {
            this.active_sName1.push(id);
          }
        } else {
          if (!this.active_sName2.includes(id)) {
            this.active_sName2.push(id);
          }
        }
      }
    },
    onDragdrop(item) {
      this.Dragleaveid = item.id;
      console.log(item.id, "onDragdrop");
    },
    handleyidong(item) {
      if (item.yidongordelete == "移动") {
        item.yidongordelete = "清除";
        item.is_show = true;
      } else {
        item.yidongordelete = "移动";
        item.is_show = false;
        item.checkids = [];
        item.methodBody.forEach((list) => {
          list.ischecked = false;
          list.disa_bled = false;
        });
      }
    },

    handlecheckbox(value, Body, item) {
      if (value) {
        if (!item.checkids.includes(Body.id)) {
          item.checkids.push(Body.id);
        }
        item.methodBody.forEach((list) => {
          if (list.parentId !== Body.parentId) {
            list.disa_bled = true;
          } else {
            list.disa_bled = false;
          }
        });
      } else {
        if (item.checkids.includes(Body.id)) {
          let index = item.checkids.indexOf(Body.id);
          item.checkids.splice(index, 1);
        }
        const flag = item.methodBody.some(
          (item) => item.parentId == Body.parentId && item.ischecked
        );
        if (flag) {
          item.methodBody.forEach((list) => {
            if (list.parentId !== Body.parentId) {
              list.disa_bled = true;
            }
          });
        } else {
          item.methodBody.forEach((list) => {
            list.disa_bled = false;
          });
        }
      }
      console.log(item.checkids, 1111111);
    },
    async handleEnd(item) {
      const keys = Object.keys(this.dragCurrentandTargetidx);
      if (keys.length == 0) {
        if (
          this.startObj &&
          this.Dragleaveid == this.DragEnterid &&
          this.startObj.methodId !== this.Dragleaveid
        ) {
          let preObj = null;
          if (this.isClicktree) {
            preObj = this.clicktree_Information.controller.methods.find(
              (list) => list.id == this.Dragleaveid
            );
          } else {
            if (this.activeName === "first") {
              preObj = this.interface_Information.controller.methods.find(
                (list) => list.id == this.Dragleaveid
              );
            } else {
              preObj = this.interface_Information.service?.methods.find(
                (list) => list.id == this.Dragleaveid
              );
            }
          }
          let componentIds = [];
          if (item.checkids.includes(this.startObj.id)) {
            componentIds = item.checkids;
          } else {
            componentIds = [this.startObj.id];
          }
          if (preObj) {
            const dragObj = {
              classId: item.classId,
              currentMethodId: this.startObj.methodId,
              componentIds,
              targetMethodId: preObj.id,
              targetParentComponentId: preObj.id,
              targetIndex: 0,
            };
            const res = await remove_component_position(dragObj);
            if (res.code == 200) {
              console.log(11);
              this.componentClassjson();
            }
          }
        }
        return;
      }
      let preObj = null;
      if (this.isClicktree) {
        preObj = this.clicktree_Information.controller.methods.find(
          (list) => list.id == this.dragCurrentandTargetidx.id
        );
      } else {
        if (this.activeName === "first") {
          preObj = this.interface_Information.controller.methods.find(
            (list) => list.id == this.dragCurrentandTargetidx.id
          );
        } else {
          preObj = this.interface_Information.service?.methods.find(
            (list) => list.id == this.dragCurrentandTargetidx.id
          );
        }
      }
      const idxs = this.dragCurrentandTargetidx.newIndex;
      if (this.dragCurrentandTargetidx.added) {
        if (
          this.dragCurrentandTargetidx.newIndex > 0 &&
          this.dragCurrentandTargetidx.newIndex == preObj.methodBody.length
        ) {
          this.dragCurrentandTargetidx.newIndex--;
        }
      }
      let targetObj = null;
      if (preObj.methodBody?.length) {
        targetObj = preObj.methodBody[this.dragCurrentandTargetidx.newIndex];
        if (this.dragCurrentandTargetidx.added) {
          if (idxs > 0 && idxs == preObj.methodBody.length) {
            targetObj.componentIndex = targetObj.componentIndex + 1;
          }
        }
      } else {
        targetObj = {
          methodId: preObj.id,
          parentId: preObj.id,
          componentIndex: 0,
        };
      }
      let componentIds = [];
      console.log(this.dragCurrentandTargetidx.currentObj, "当前的");
      if (item.checkids.includes(this.dragCurrentandTargetidx.currentObj.id)) {
        componentIds = item.checkids;
      } else {
        componentIds = [this.dragCurrentandTargetidx.currentObj.id];
      }
      const dragObj = {
        classId: item.classId,
        currentMethodId: this.dragCurrentandTargetidx.currentObj.methodId,
        componentIds,
        targetMethodId: targetObj.methodId,
        targetParentComponentId: targetObj.parentId,
        targetIndex: targetObj.componentIndex,
      };
      try {
        const res = await remove_component_position(dragObj);
        if (res.code == 200) {
          console.log(11);
          this.componentClassjson();
        }
      } finally {
        console.log(22);
        this.dragCurrentandTargetidx = {};
      }
    },
    handleaddjiahao() {
      this.addbaoformdialog.lists.push({
        value: "",
      });
    },
    handle_Delete(index) {
      if (this.addbaoformdialog.lists.length > 1) {
        this.addbaoformdialog.lists.splice(index, 1);
      }
    },
    Informationfengzhuang(obj) {
      obj.controller?.methods?.forEach((item) => {
        item.methodBody.forEach(async (list) => {
          if (!list.componentDesc) {
            list.componentDesc = list.sourceCode;
          }
        });
      });
      obj.service?.methods?.forEach((item) => {
        item.methodBody.forEach(async (list) => {
          if (!list.componentDesc) {
            list.componentDesc = list.sourceCode;
          }
        });
      });
    },
    async projectManageprojectModellist() {
      this.moduleLists = [];
      const res = await projectManageprojectModellist(
        +sessionStorage.getItem("developLowCodeId")
      );
      if (res?.code === 200) {
        this.moduleLists = res.data;
      }
    },
    handleTabClick(tab, event) {
      if (tab.name === "first") {
        this.classType = this.interfaceInformation.controller?.classType;
      } else {
        this.classType = this.interfaceInformation.service?.classType;
      }
      console.log(this.classType, this.activeName, "handleTabClick");

      this.activeIndex = undefined;
      this.handleLook();
    },
    async handleInterLogic(row) {
      const res = await findInterfaceClass(row.id);
      this.interfaceInformation = JSON.parse(JSON.stringify(res.data));
      this.interface_Information = JSON.parse(JSON.stringify(res.data));
      this.Informationfengzhuang(this.interfaceInformation);
      this.isShowTable = false;
      this.isapi = false;
      if (!this.interfaceInformation.service) {
        this.activeName = "first";
      }
      if (this.activeName === "first") {
        this.classType = this.interfaceInformation.controller?.classType;
      } else {
        this.classType = this.interfaceInformation.service?.classType;
      }
      console.log(this.classType, this.activeName, "接口逻辑");

      this.$parent.$parent.$parent.$parent.activeitemName = `${row.requestChName}接口逻辑:${row.requestName}`;
      this.$parent.$parent.$parent.$parent.activeState = `${row.requestChName}接口逻辑:${row.requestName}`;
      this.$parent.$parent.$parent.$parent.isaddTitleLists(
        `${row.requestChName}接口逻辑:${row.requestName}`,
        this.interfaceInformation
      );
      // this.$parent.$parent.$parent.$parent.handleadFangfaAdd("addfangfa");
      this.handleLook();
    },
    handleEadit(row) {
      this.btnTitle = "重新生成接口代码";
      this.isShowTable = false;
      this.$parent.$parent.$parent.$parent.activeitemName = `编辑API:${row.requestName}`;
      this.$parent.$parent.$parent.$parent.activeState = `编辑API:${row.requestName}`;
      this.$parent.$parent.$parent.$parent.isaddTitleLists(
        `编辑API${row.requestName}`,
        row
      );
      this.$nextTick(() => {
        this.$refs["dialogForm"].resetFields();
        this.formData = JSON.parse(JSON.stringify(row));
        this.formData.requestParams = JSON.parse(row.requestParams);
        this.formData.requestParams.forEach((item) => {
          const obj = this.leixingOnlyLists.find(
            (v) => v.value == item.paramsType
          );
          if (obj) {
            this.$set(item, "params_Type", obj.Label_Desc);
          } else {
            this.$set(item, "params_Type", item.paramsType);
          }
        });
        this.formOldData = JSON.parse(JSON.stringify(this.formData));
        if (this.formData.returnType.startsWith("Result")) {
          let index2 = this.formData.returnType.lastIndexOf(">");
          const returnTypeAndelementType = this.formData.returnType.slice(
            7,
            index2
          );
          this.handleEditelement_Type(
            returnTypeAndelementType,
            this.formData,
            "returnType",
            "return_Type",
            this.leixingLists,
            true //这里需要传true
          );
        } else {
          this.$set(this.formData, "return_Type", this.formData.returnType);
        }
      });
    },
    handleClose() {
      this.EditAttributedialog = false;
      // this.activeIndex=undefined
    },
    AttributeSave() {
      this.$refs["EditAttributeObj"].validate(async (valid) => {
        if (valid) {
          const res = await updateClassGlobalAttribute(
            this.returnClassId(),
            this.EditAttributeObj.index,
            {
              type: this.EditAttributeObj.type,
              name: this.EditAttributeObj.name,
              annotation: this.EditAttributeObj.annotation,
              chName: this.EditAttributeObj.chName,
              value: this.EditAttributeObj.value,
            }
          );
          if (res?.code === 200) {
            this.$message({
              message: "修改成功",
              type: "success",
            });
            this.EditAttributedialog = false;
            this.componentClassjson();
          }
        }
      });
    },
    handleActiveHighlight(index, item) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = index;
      this.handleLook();
    },
    handleEditAttribute(item, index, idexName) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = idexName;
      this.EditAttributedialog = true;
      this.EditAttributeObj = JSON.parse(JSON.stringify(item));
      this.EditAttributeObj.index = index;
      if (["long", "float"].includes(this.EditAttributeObj.type)) {
        if (
          this.EditAttributeObj.value[
            this.EditAttributeObj.value.length - 1
          ] === "L" ||
          this.EditAttributeObj.value[
            this.EditAttributeObj.value.length - 1
          ] === "F"
        ) {
          this.EditAttributeObj.value = this.EditAttributeObj.value.slice(
            0,
            this.EditAttributeObj.value.length - 1
          );
        }
      }
    },
    handleDeleteAttribute(item, idx) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = idx;
      this.$confirm("确定要进行删除操作?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const res = await deleteClassGlobalAttribute({
            classId: this.returnClassId(),
            attributeName: item.name,
          });
          if (res?.code === 200) {
            this.$message({
              message: "删除成功",
              type: "success",
            });
            this.componentClassjson();
          }
        })
        .catch(() => {
          // this.activeIndex=undefined
        });
    },
    handleAddbao() {
      this.addbaodialog = true;
      this.addbaoformdialog.lists = [
        {
          value: "",
        },
      ];
    },
    handleDeletebao() {
      this.deleteBaodialog = true;
      this.deletebaoformdialog.lists = [];
    },
    async handleSureAddbao() {
      this.$refs.addbaoformdialog.validate(async (valid) => {
        if (valid) {
          const lists = this.addbaoformdialog.lists.map((item) => item.value);
          const res = await addClassImports(this.returnClassId(), lists);
          if (res?.code === 200) {
            this.$message({
              message: "添加成功",
              type: "success",
            });
            this.addbaodialog = false;
            this.componentClassjson();
          }
        }
      });
    },
    handleSuredeletebao() {
      this.$refs.deletebaoformdialog.validate(async (valid) => {
        if (valid) {
          const lists = this.deletebaoformdialog.lists.reduce((pre, next) => {
            pre.push(this.optionsBao[next]);
            return pre;
          }, []);
          const res = await deleteClassImports(this.returnClassId(), lists);
          if (res?.code === 200) {
            this.$message({
              message: "删除成功",
              type: "success",
            });
            this.deleteBaodialog = false;
            this.componentClassjson();
          }
        }
      });
    },
    handleAddattribuite() {
      this.diaVisible = true;
      sessionStorage.setItem("activeState", "创建属性");
      sessionStorage.setItem("isCreateAttribute", "否"); //是 代表创建属性 否 代表增加全局属性
      this.$nextTick(() => {
        this.$refs.describeComponent.activeTitle = "增加全局属性";
      });
    },
    handleExport() {
      let classId;
      if (this.isClicktree) {
        classId = this.clicktreeInformation.controller.classId;
      } else {
        if (this.activeName === "first") {
          classId = this.interfaceInformation.controller.classId;
        } else {
          classId = this.interfaceInformation.service?.classId;
        }
      }
      window.location.href = `${
        process.env.VUE_APP_BASE_API
      }/generate/code_json/download_class_file?${qs.stringify({
        classId,
        token: getToken(),
      })}`;
      this.$message({
        showClose: true,
        message: "正在下载...",
        type: "warning",
        showClose: true,
      });
    },
    handleReturnTypeChange(value) {
      if (value === "+") {
        this.$store.state.user.objServicedelog = true;
        this.formData.return_Type = "";
        this.formData.returnType = "";
      } else {
        const obj = this.leixingLists.find((item) => item.Label_Desc === value);
        if (obj) {
          this.formData.returnType = obj.value;
        } else {
          this.formData.returnType = value;
        }
        if (value === "List | 集合列表") {
          this.$set(
            this.formData,
            "element_Type",
            this.elementLists[0]?.Label_Desc ?? ""
          );
          this.$set(
            this.formData,
            "elementType",
            this.elementLists[0]?.value ?? ""
          );
        } else {
          this.$set(this.formData, "element_Type", "");
          this.$set(this.formData, "elementType", "");
        }
      }
      console.log(this.formData.return_Type, this.formData.returnType, 4562300);
    },
    handleParamsChange(value, item) {
      if (value === "+") {
        this.$store.state.user.objServicedelog = true;
        item.params_Type = "";
        item.paramsType = "";
      } else {
        const obj = this.leixingOnlyLists.find(
          (item) => item.Label_Desc === value
        );
        if (obj) {
          item.paramsType = obj.value;
        } else {
          item.paramsType = value;
        }
      }
    },
    handleReturnElement(value) {
      if (value === "+") {
        this.$store.state.user.objServicedelog = true;
        this.formData.element_Type = "";
        this.formData.elementType = "";
      } else {
        const obj = this.elementLists.find((item) => item.Label_Desc === value);
        if (obj) {
          this.formData.elementType = obj.value;
        } else {
          this.formData.elementType = value;
        }
      }
    },
    returnChange(value) {
      if (value === "+") {
        this.$store.state.user.objServicedelog = true;
      }
    },
    handleRest() {
      this.formInline.requestName = "";
      this.formInline.requestChName = "";
      this.getList();
    },
    // 获取表格数据
    async getList() {
      this.tableList = [];
      const res = await jlcpInterfaceInfo(this.formInline);
      if (res?.code === 200) {
        this.tableList = JSON.parse(JSON.stringify(res.data));
        this.tableList.forEach((item) => {
          const parmesLists = item.requestParams
            ? JSON.parse(item.requestParams)
            : [];
          this.$set(item, "request_Params", parmesLists);
        });
      }
    },
    packageFn(Body) {
      this.$refs.describeEditComponent.activedecName = [1, 16, 17].includes(
        Body.componentType
      )
        ? "ruleForm"
        : [2, 3].includes(Body.componentType)
        ? "rulecirculateForm"
        : Body.componentType == 5
        ? "Formmodel"
        : Body.componentType == 4
        ? "FormCrete"
        : Body.componentType == 14
        ? "returnComponent"
        : Body.componentType == 7
        ? "createInstance"
        : [8, 9].includes(Body.componentType)
        ? "continueCurrentInstance"
        : [18, 19, 20, 21].includes(Body.componentType)
        ? "dbOperationsComponent"
        : Body.componentType == 22
        ? "InstanceAssignment"
        : Body.componentType == 23
        ? "componentsToCollection"
        : [24, 25].includes(Body.componentType)
        ? "FindCollectionElement"
        : Body.componentType == 26
        ? Body.paramsJson.calculateType === "BASIC"
          ? "BASICcalculationComponent"
          : Body.paramsJson.calculateType === "HIGH_LEVEL"
          ? "LEVELcalculationComponent"
          : "numericFormatting"
        : Body.componentType == 27
        ? Body.paramsJson.operateType === "TRANS"
          ? "formatConversion"
          : Body.paramsJson.operateType === "DATE"
          ? "dateOperation"
          : "timeOperation"
        : Body.componentType == 28
        ? "consoleLogObj"
        : Body.componentType == 29
        ? "codeHintObj"
        : Body.componentType == 30
        ? "stringObj"
        : Body.componentType == 31 || Body.componentType == 32
        ? "notificationObj"
        : Body.componentType == 33
        ? "yicixingdingshiObj"
        : Body.componentType == 34
        ? "stringConcatenation"
        : Body.componentType == 35
        ? "requestHttpObj"
        : Body.componentType == 36
        ? "callComponentObj"
        : Body.componentType == 37
        ? "componentsCreateCollection"
        : "";
      this.$refs.describeEditComponent.activeTitle = [1, 16, 17].includes(
        Body.componentType
      )
        ? "条件判断"
        : [2, 3].includes(Body.componentType)
        ? "循环控制"
        : Body.componentType == 5
        ? "调用方法"
        : Body.componentType == 4
        ? "创建属性"
        : Body.componentType == 14
        ? "返回组件"
        : Body.componentType == 7
        ? "创建实例组件"
        : Body.componentType == 8
        ? "结束循环组件"
        : Body.componentType == 9
        ? "打断当前循环组件"
        : // : [18, 19, 20, 21].includes(Body.componentType)
        // ? "数据库操作组件"
        Body.componentType == 18
        ? "查询"
        : Body.componentType == 19
        ? "更新"
        : Body.componentType == 20
        ? "删除"
        : Body.componentType == 21
        ? "SQL"
        : Body.componentType == 22
        ? "实例赋值组件"
        : Body.componentType == 23
        ? "集合元素添加组件"
        : Body.componentType == 24 && Body.paramsJson.filterType == "1"
        ? "按集合下标获取元素"
        : Body.componentType == 24 && Body.paramsJson.filterType == "2"
        ? "按条件筛选元素"
        : Body.componentType == 25 && Body.paramsJson.filterType == "1"
        ? "按集合下标删除"
        : Body.componentType == 25 && Body.paramsJson.filterType == "2"
        ? "按条件筛选删除"
        : Body.componentType == 26
        ? Body.paramsJson.calculateType === "BASIC"
          ? "基础运算"
          : Body.paramsJson.calculateType === "HIGH_LEVEL"
          ? "高阶运算"
          : "数值格式化"
        : Body.componentType == 27
        ? Body.paramsJson.operateType === "TRANS"
          ? "格式转换"
          : Body.paramsJson.operateType === "DATE"
          ? "日期运算"
          : "日期/时间比较"
        : Body.componentType == 28
        ? "控制台日志"
        : Body.componentType == 29
        ? "自定义代码段"
        : Body.componentType == 30
        ? "字符串操作"
        : Body.componentType == 31
        ? "短信通知"
        : Body.componentType == 32
        ? "邮件通知"
        : Body.componentType == 33
        ? "添加一次性定时任务"
        : Body.componentType == 34
        ? "字符串拼接"
        : Body.componentType == 35
        ? "HTTP请求"
        : Body.componentType == 36
        ? "feign调用"
        : Body.componentType == 37
        ? "创建集合"
        : "";
    },
    //classId是tree点击项的id,Body是组件编辑时新的对象内容信息
    async componentClassjson(classId, Body) {
      const class_Id = classId || this.returnClassId();
      try {
        this.ClicktreeLoading = true;
        const res = await componentClassjson(class_Id);
        this.ClicktreeLoading = false;
        if (res?.code === 200) {
          res.data.methods.forEach((item) => {
            item.methodBody.forEach(async (list) => {
              if (!list.componentDesc) {
                list.componentDesc = list.sourceCode;
              }
            });
          });
          if (this.isClicktree) {
            this.clicktreeInformation.controller = JSON.parse(
              JSON.stringify(res.data)
            );
            this.clicktree_Information.controller = JSON.parse(
              JSON.stringify(res.data)
            );
            this.$parent.$parent.$parent.$parent.activeitemName =
              res.data.className;
            this.classType = res.data.classType;

            const obj = this.$parent.$parent.$parent.$parent.titleLists.find(
              (item) => item.name === res.data.className
            );
            if (!obj) {
              this.$parent.$parent.$parent.$parent.titleLists.push({
                classId: class_Id,
                name: res.data.className,
                svg: res.data.className,
                btnName: "显示源码", //显示源码
                controllerOrservice: JSON.parse(JSON.stringify(res.data)),
              });
              this.$nextTick(async () => {
                const dom = document.getElementById(res.data.className);
                dom.parentElement.scrollLeft = dom.offsetLeft;
              });
            } else {
              this.$nextTick(async () => {
                const dom = document.getElementById(obj.svg);
                dom.parentElement.scrollLeft = dom.offsetLeft;
              });
              obj.controllerOrservice = JSON.parse(JSON.stringify(res.data));
            }
          } else {
            if (this.activeName === "first") {
              this.interfaceInformation.controller = JSON.parse(
                JSON.stringify(res.data)
              );
              this.interface_Information.controller = JSON.parse(
                JSON.stringify(res.data)
              );
            } else {
              this.interfaceInformation.service = JSON.parse(
                JSON.stringify(res.data)
              );
              this.interface_Information.service = JSON.parse(
                JSON.stringify(res.data)
              );
            }
            this.$parent.$parent.$parent.$parent.isaddTitleLists(
              this.$parent.$parent.$parent.$parent.activeitemName,
              this.interfaceInformation
            );
          }

          await this.handleLook(Body);
        }
      } catch (err) {
        this.ClicktreeLoading = false;
      }
    },
    //Body是组件编辑时新的对象内容信息
    async handleLook(Body) {
      if (this.returnClassId()) {
        try {
          this.someLoading = true;
          const res = await generateSomeClassCode(this.returnClassId());
          this.someLoading = false;
          if (res?.code === 200) {
            this.someSourceCode.content = res.data;
            if (Body) {
              if (this.activeIndex?.endsWith("方法体编辑")) {
                const idx = this.activeIndex.slice(0, -2) + "高亮";
                this.handleChildEditlight(
                  idx,
                  this.addBasicObj.item,
                  Body,
                  this.addBasicObj.index3,
                  this.addBasicObj.className,
                  this.addBasicObj.tabActiveName
                );
              }
            } else {
              //类详情页面tab页切换的时候保留上次操作的状态
              const obj = this.$parent.$parent.$parent.$parent.titleLists.find(
                (item) =>
                  item.name ===
                  this.$parent.$parent.$parent.$parent.activeitemName
              );
              if (obj) {
                obj.someSourceCodeContent = res.data;
                this.statusLogic(obj);
              }
            }
          }
        } catch (err) {
          this.someLoading = false;
        }
      }
    },
    statusLogic(obj) {
      if (this.isClicktree) {
        this.active_Name = obj.active_Name;
        console.log(this.active_Name, "statusLogic");

        if (obj.highlightActive) {
          obj.highlightActive.tabActiveName = obj.active_Name;
          this.tabPagejson(obj, "highlightActive", "active_Name");
        } else {
          // this.active_Name = undefined;
          this.fengzhuang();
        }
      } else {
        if (this.activeName === "first") {
          this.active_sName1 = obj.active_sName1;
          if (obj.activeController) {
            obj.activeController.tabActiveName = obj.active_sName1;
            this.tabPagejson(obj, "activeController", "active_sName1");
          } else {
            // this.active_sName1 = undefined;
            this.fengzhuang();
          }
        } else {
          this.active_sName2 = obj.active_sName2;
          if (obj.activeServer) {
            obj.activeServer.tabActiveName = obj.active_sName2;
            this.tabPagejson(obj, "activeServer", "active_sName2");
          } else {
            // this.active_sName2 = undefined;
            this.fengzhuang();
          }
        }
      }
    },
    blockSmoothScroll(element) {
      return new Promise((resolve) => {
        element && element.scrollIntoView();
        setTimeout(resolve, 1000); // 可根据实际情况调整延迟时间
      });
    },
    async tabPagejson(obj, name, active_Name) {
      const SPANDOM = document.querySelector(`.${obj[name].className}`);
      this[active_Name] = obj[name].tabActiveName;
      setTimeout(async () => {
        // await this.blockSmoothScroll(SPANDOM);
        SPANDOM.scrollIntoView({ block: "center" });
        this.handleChildEditlight(
          obj[name].idx,
          obj[name].item,
          obj[name].Body,
          obj[name].index3,
          obj[name].className,
          this[active_Name]
        );
      }, 500);
    },
    fengzhuang() {
      this.$nextTick(() => {
        const vueCodemirrorDOM = document.querySelector(
          ".CodeMirror-activeline"
        );
        vueCodemirrorDOM?.scrollIntoView();
      });
    },
    //className是用于获取dom定位滚动条位置
    async handleChildEditlight(
      idx,
      item,
      Body,
      index3,
      className,
      tabActiveName
    ) {
      if (this.isdbcaozuozujian.includes(Body.componentType)) {
        this.$parent.$parent.$parent.$parent.isClickCom = false;
      } else {
        this.$parent.$parent.$parent.$parent.isClickCom = true;
      }
      this.activeIndex = idx;
      this.addBasicObj.isMethodOrBody = "方法体";
      this.addBasicObj.item = item;
      this.addBasicObj.isMethodObjOrBody = Body;
      this.addBasicObj.index3 = index3;

      const obj = this.$parent.$parent.$parent.$parent.titleLists.find(
        (item) =>
          item.name === this.$parent.$parent.$parent.$parent.activeitemName
      );
      if (obj) {
        if (this.isClicktree) {
          obj.highlightActive = {
            idx,
            item,
            Body,
            index3,
            className,
            tabActiveName,
          };
        } else {
          if (this.activeName === "first") {
            obj.activeController = {
              idx,
              item,
              Body,
              index3,
              className,
              tabActiveName,
            };
          } else {
            obj.activeServer = {
              idx,
              item,
              Body,
              index3,
              className,
              tabActiveName,
            };
          }
        }
      }

      const res = await codeJsongenerateCode(
        Body.paramsJson,
        Body.componentType,
        Body.id
      );
      if (res?.code == 200) {
        this.handlemarkText(res.data);
      }
    },

    async handlemarkText(val) {
      this.$nextTick(() => {
        this.$refs.codemirrorvue1.markText(val);
        const keywordDom = Array.from(
          document.querySelectorAll(".custom-keyword")
        )[0];
        if (keywordDom) {
          keywordDom.scrollIntoView();
          // this.blockSmoothScroll(keywordDom); // 平滑滚动到指定位置
        } else {
          const vueCodemirrorDOM = document.querySelector(
            ".CodeMirror-activeline"
          );
          vueCodemirrorDOM.scrollIntoView();
          // this.blockSmoothScroll(vueCodemirrorDOM);
        }
      });
    },
    handleChildEdit3(
      idx,
      Body,
      index3,
      methodBody,
      item,
      className,
      tabActiveName
    ) {
      this.addBasicObj.item = item;
      this.addBasicObj.index3 = index3;
      this.addBasicObj.className = className;
      this.addBasicObj.tabActiveName = tabActiveName;

      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = idx;
      this.activeObj = Body;
      this.diaEditVisible = true;
      this.$nextTick(async () => {
        this.packageFn(Body);
        this.$refs.describeEditComponent.ruleForm.lianjie_Lists = [];
        if (Body.componentType === 1) {
          // 条件判断
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          const conditionParams1 = JSON.parse(
            JSON.stringify(Body.paramsJson.conditionParams)
          );
          conditionParams1.forEach((item) => {
            Object.assign(item, item.paramsJson);
            // 从外部项目导入暂时没有compareSignType是符号的数据
            if (item.compareSignType == "api") {
              this.handleEditClazz_NameAndMethod_Name(item, 1);
            }
          });
          this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
            name: "if",
            componentDesc: Body.componentDesc,
            conditionParams: conditionParams1,
            currentData: Body,
          });
          let nextIdx = index3 + 1;
          while (
            methodBody[nextIdx] &&
            (methodBody[nextIdx].componentType === 16 ||
              methodBody[nextIdx].componentType === 17)
          ) {
            if (methodBody[nextIdx].componentType === 16) {
              const conditionParams2 = JSON.parse(
                JSON.stringify(methodBody[nextIdx].paramsJson.conditionParams)
              );
              conditionParams2.forEach((item) => {
                Object.assign(item, item.paramsJson);
                if (item.compareSignType == "api") {
                  this.handleEditClazz_NameAndMethod_Name(item, 1);
                }
              });
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
                name: "else if",
                componentDesc: methodBody[nextIdx].componentDesc,
                conditionParams: conditionParams2,
                currentData: methodBody[nextIdx],
              });
            } else {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
                name: "else",
                componentDesc: methodBody[nextIdx].componentDesc,
                currentData: methodBody[nextIdx],
              });
            }
            nextIdx++;
          }
        } else if (Body.componentType === 16) {
          // 条件判断
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          let preIdx = index3 - 1;
          let isIf = false;
          while (
            preIdx >= 0 &&
            methodBody[preIdx] &&
            (methodBody[preIdx].componentType === 1 ||
              methodBody[preIdx].componentType === 16)
          ) {
            if (isIf) {
              break;
            }
            if (methodBody[preIdx].componentType === 1) {
              isIf = true;
            }
            const conditionParams3 = JSON.parse(
              JSON.stringify(methodBody[preIdx].paramsJson.conditionParams)
            );
            conditionParams3.forEach((item) => {
              Object.assign(item, item.paramsJson);
              if (item.compareSignType == "api") {
                this.handleEditClazz_NameAndMethod_Name(item, 1);
              }
            });
            if (methodBody[preIdx].componentType === 1) {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.unshift({
                name: "if",
                componentDesc: methodBody[preIdx].componentDesc,
                conditionParams: conditionParams3,
                currentData: methodBody[preIdx],
              });
            } else {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.unshift({
                name: "else if",
                componentDesc: methodBody[preIdx].componentDesc,
                conditionParams: conditionParams3,
                currentData: methodBody[preIdx],
              });
            }
            preIdx--;
          }
          const conditionParams4 = JSON.parse(
            JSON.stringify(Body.paramsJson.conditionParams)
          );
          conditionParams4.forEach((item) => {
            Object.assign(item, item.paramsJson);
            if (item.compareSignType == "api") {
              this.handleEditClazz_NameAndMethod_Name(item, 1);
            }
          });
          this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
            name: "else if",
            componentDesc: Body.componentDesc,
            conditionParams: conditionParams4,
            currentData: Body,
          });

          let nextIdx = index3 + 1;
          while (
            methodBody[nextIdx] &&
            (methodBody[nextIdx].componentType === 16 ||
              methodBody[nextIdx].componentType === 17)
          ) {
            if (methodBody[nextIdx].componentType === 16) {
              const conditionParams5 = JSON.parse(
                JSON.stringify(methodBody[nextIdx].paramsJson.conditionParams)
              );
              conditionParams5.forEach((item) => {
                Object.assign(item, item.paramsJson);
                if (item.compareSignType == "api") {
                  this.handleEditClazz_NameAndMethod_Name(item, 1);
                }
              });
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
                name: "else if",
                componentDesc: methodBody[nextIdx].componentDesc,
                conditionParams: conditionParams5,
                currentData: methodBody[nextIdx],
              });
            } else {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
                name: "else",
                componentDesc: methodBody[nextIdx].componentDesc,
                currentData: methodBody[nextIdx],
              });
            }
            nextIdx++;
          }
        } else if (Body.componentType === 17) {
          // 条件判断
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          let preIdx = index3 - 1;
          let isIf = false;
          while (
            preIdx >= 0 &&
            methodBody[preIdx] &&
            (methodBody[preIdx].componentType === 1 ||
              methodBody[preIdx].componentType === 16)
          ) {
            if (isIf) {
              break;
            }
            if (methodBody[preIdx].componentType === 1) {
              isIf = true;
            }
            const conditionParams6 = JSON.parse(
              JSON.stringify(methodBody[preIdx].paramsJson.conditionParams)
            );
            conditionParams6.forEach((item) => {
              Object.assign(item, item.paramsJson);
              if (item.compareSignType == "api") {
                this.handleEditClazz_NameAndMethod_Name(item, 1);
              }
            });
            if (methodBody[preIdx].componentType === 1) {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.unshift({
                name: "if",
                componentDesc: methodBody[preIdx].componentDesc,
                conditionParams: conditionParams6,
                currentData: methodBody[preIdx],
              });
            } else {
              this.$refs.describeEditComponent.ruleForm.lianjie_Lists.unshift({
                name: "else if",
                componentDesc: methodBody[preIdx].componentDesc,
                conditionParams: conditionParams6,
                currentData: methodBody[preIdx],
              });
            }
            preIdx--;
          }
          this.$refs.describeEditComponent.ruleForm.lianjie_Lists.push({
            name: "else",
            componentDesc: Body.componentDesc,
            currentData: Body,
          });
        } else if (Body.componentType === 3 || Body.componentType === 2) {
          // 循环控制
          this.$refs.describeEditComponent.rulecirculateForm = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          if (Body.paramsJson.loopType === 2) {
            await this.$refs.describeEditComponent.handleTypeChang(
              this.$refs.describeEditComponent.rulecirculateForm.collectionType,
              true
            );
            const isHasClazz_Name = Reflect.has(
              this.$refs.describeEditComponent.rulecirculateForm,
              "collection_Name"
            );
            if (!isHasClazz_Name) {
              const obj = this.$refs.describeEditComponent.jiheLists.find(
                (item) =>
                  item.name ==
                  this.$refs.describeEditComponent.rulecirculateForm
                    .collectionName
              );
              if (obj) {
                this.$set(
                  this.$refs.describeEditComponent.rulecirculateForm,
                  "collection_Name",
                  obj.Label_Desc
                );
              } else {
                this.$refs.describeEditComponent.rulecirculateForm,
                  "collection_Name",
                  this.$refs.describeEditComponent.rulecirculateForm
                    .collectionName;
              }
            }
          }
        } else if (Body.componentType === 5) {
          // 调用方法
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          this.$refs.describeEditComponent.Formmodel = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$set(
            this.$refs.describeEditComponent.Formmodel,
            "componentDesc",
            Body.componentDesc
          );
          this.handleEditClazz_NameAndMethod_Name(
            this.$refs.describeEditComponent.Formmodel,
            2
          );
        } else if (Body.componentType === 4) {
          // 创建属性
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          await this.$refs.describeEditComponent.findClassInstance(
            this.returnProjectEditIdandclassId()
          );
          this.$refs.describeEditComponent.FormCrete = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$refs.describeEditComponent.Form_Crete =
            this.$refs.describeEditComponent.FormCrete;
          this.$refs.describeEditComponent.FormCrete.propertyValueType =
            +this.$refs.describeEditComponent.FormCrete.propertyValueType;
          this.$set(
            this.$refs.describeEditComponent.FormCrete,
            "componentDesc",
            Body.componentDesc
          );
          const _propertyType_ =
            this.$refs.describeEditComponent.FormCrete.propertyType;
          this.handleEditelement_Type(
            _propertyType_,
            this.$refs.describeEditComponent.FormCrete,
            "propertyType",
            "property_Type",
            this.leixingLists
          );
          if (
            this.$refs.describeEditComponent.FormCrete.propertyValueType === 1
          ) {
            const propertyValue =
              this.$refs.describeEditComponent.FormCrete.componentVo
                .propertyValue;
            if (
              propertyValue[propertyValue.length - 1] === "L" ||
              propertyValue[propertyValue.length - 1] === "F"
            ) {
              this.$refs.describeEditComponent.FormCrete.componentVo.propertyValue =
                propertyValue.slice(0, propertyValue.length - 1);
            }
          } else if (
            this.$refs.describeEditComponent.FormCrete.propertyValueType === 2
          ) {
            this.handleEditClazz_NameAndMethod_Name(
              this.$refs.describeEditComponent.FormCrete.componentVo,
              3
            );
          }
        } else if (Body.componentType === 14) {
          // 返回组件
          this.$refs.describeEditComponent.returnComponent = {
            componentDesc: Body.componentDesc,
            returnValue: Body.paramsJson.returnValue,
          };
        } else if (Body.componentType === 7) {
          // 创建实例组件
          let class_Name = "";
          const obj = this.create_InstanceClassLists.find(
            (item) => item.value === Body.paramsJson.className
          );
          if (obj) {
            class_Name = obj.Label_Desc;
          } else {
            class_Name = Body.paramsJson.className;
          }
          this.$refs.describeEditComponent.createInstance = {
            componentDesc: Body.componentDesc,
            instanceName: Body.paramsJson.instanceName,
            className: Body.paramsJson.className,
            class_Name,
            params: Body.paramsJson.params,
          };
        } else if ([8, 9].includes(Body.componentType)) {
          // 打断当前循环组件和结束循环组件
          this.$refs.describeEditComponent.continueCurrentInstance = {
            componentDesc: Body.componentDesc,
          };
        } else if ([18, 19, 20, 21].includes(Body.componentType)) {
          // 数据库操作查询，更新，删除，SQL
          this.$refs.describeEditComponent.dbOperationsComponent = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$refs.describeEditComponent.dbOperationsComponent.componentParams =
            JSON.parse(Body.paramsJson.componentParams);
          this.$refs.describeEditComponent.dbOperationsComponent.returnName =
            "result";
          this.$set(
            this.$refs.describeEditComponent.dbOperationsComponent,
            "componentDesc",
            Body.componentDesc
          );
          if (this.$refs.describeEditComponent.activeTitle === "查询") {
            this.$refs.describeEditComponent.dbOperationsComponent.radio =
              "SELECT";
          } else if (this.$refs.describeEditComponent.activeTitle === "更新") {
            this.$refs.describeEditComponent.dbOperationsComponent.radio =
              "UPDATE";
          } else if (this.$refs.describeEditComponent.activeTitle === "删除") {
            this.$refs.describeEditComponent.dbOperationsComponent.radio =
              "DELETE";
          } else if (this.$refs.describeEditComponent.activeTitle === "SQL") {
            this.$refs.describeEditComponent.dbOperationsComponent.radio =
              "SQL";
          }
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.methodClassName();
          await this.$refs.describeEditComponent.getList();
          await this.$refs.describeEditComponent.getInterfaceLists();
          const objsss = this.$refs.describeEditComponent.descLists.find(
            (item) =>
              item.id ==
              this.$refs.describeEditComponent.dbOperationsComponent.id
          );
          if (objsss) {
            this.$set(
              this.$refs.describeEditComponent.dbOperationsComponent,
              "component_Params",
              JSON.parse(objsss.paramsIn)
            );
            this.$refs.describeEditComponent.dbOperationsComponent.componentParams.forEach(
              (item) => {
                this.$refs.describeEditComponent.dbOperationsComponent.component_Params.forEach(
                  (child) => {
                    this.$set(child, "targetParamName", item.targetParamName);
                    const typeLists =
                      this.$refs.describeEditComponent.Listsdata.filter(
                        (v) => v.type === child.type
                      );
                    this.$set(child, "iptsvalueLists", typeLists);
                    const obj = child.iptsvalueLists.find(
                      (n) => n.name === item.targetParamName
                    );
                    if (obj) {
                      this.$set(child, "ipt_value", obj.Label_Desc);
                    } else {
                      this.$set(child, "ipt_value", item.targetParamName);
                    }
                  }
                );
              }
            );
          }
        } else if (Body.componentType === 22) {
          // 实例赋值组件
          await this.$refs.describeEditComponent.methodClassName();
          this.$refs.describeEditComponent.findClassInstance(
            this.returnProjectEditIdandclassId()
          );
          this.$refs.describeEditComponent.InstanceAssignment = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          const attribute =
            this.$refs.describeEditComponent.InstanceAssignment.attributeValueList.map(
              (item) => {
                let returnValue = item.attributeValue.value.value;
                let method_Params =
                  item.attributeValue.value.methodParams || [];
                this.handleEditClazz_NameAndMethod_Name(
                  item.attributeValue.value,
                  4,
                  item.attributeType
                );
                return {
                  type: item.attributeType,
                  name: item.attributeName,
                  valueType: item.attributeValue.valueType,
                  value: returnValue,
                  clazzName: item.attributeValue.value.clazzName,
                  clazz_Name: item.attributeValue.value.clazz_Name,
                  methodName: item.attributeValue.value.methodName,
                  method_Name: item.attributeValue.value.method_Name,
                  methodParams: method_Params,
                  fangfaLists: item.attributeValue.value.fangfaLists,
                  instanceName: item.attributeValue.value.instanceName,
                  instanceAttribute:
                    item.attributeValue.value.instanceAttribute,
                };
              }
            );
          this.$set(
            this.$refs.describeEditComponent.InstanceAssignment,
            "attribute",
            attribute
          );
          this.$set(
            this.$refs.describeEditComponent.InstanceAssignment,
            "componentDesc",
            Body.componentDesc
          );
        } else if (Body.componentType === 23) {
          //集合操作中集合元素添加组件
          this.$refs.describeEditComponent.componentsToCollection = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$refs.describeEditComponent.handleTypeChang("List", true);
          this.$refs.describeEditComponent.findAt_tribute_ByType(
            this.$refs.describeEditComponent.componentsToCollection.itemType,
            this.returnProjectEditIdandclassId()
          );
        } else if ([24, 25].includes(Body.componentType)) {
          //集合操作中除了集合元素添加组件以外的组件
          this.$refs.describeEditComponent.FindCollectionElement = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$set(
            this.$refs.describeEditComponent.FindCollectionElement,
            "componentDesc",
            Body.componentDesc
          );
          this.$refs.describeEditComponent.handleTypeChang("List", true);
          if (
            this.$refs.describeEditComponent.FindCollectionElement
              .filterType === "2"
          ) {
            if (
              !["Integer", "String", "Boolean"].includes(
                this.$refs.describeEditComponent.FindCollectionElement.itemType
              )
            ) {
              this.$refs.describeEditComponent.find_class_attribute(
                this.$refs.describeEditComponent.FindCollectionElement.itemType,
                +sessionStorage.getItem("developLowCodeId")
              );
            }
            if (
              !["Integer", "int", "String", "Boolean"].includes(
                this.$refs.describeEditComponent.FindCollectionElement
                  .propertyType
              )
            ) {
              this.$refs.describeEditComponent.findAt_tribute_ByType(
                this.$refs.describeEditComponent.FindCollectionElement.itemType,
                this.returnProjectEditIdandclassId()
              );
            }
          }
        } else if (Body.componentType === 26) {
          // 数值操作下面的组件
          await this.$refs.describeEditComponent.params_Lists();
          if (Body.paramsJson.calculateType === "BASIC") {
            this.$refs.describeEditComponent.BASICcalculationComponent =
              JSON.parse(JSON.stringify(Body.paramsJson));
            this.$refs.describeEditComponent.activeName = "BASIC";
          } else if (Body.paramsJson.calculateType === "HIGH_LEVEL") {
            this.$refs.describeEditComponent.LEVELcalculationComponent =
              JSON.parse(JSON.stringify(Body.paramsJson));
            this.$refs.describeEditComponent.activeName = "HIGH_LEVEL";
          } else {
            this.$refs.describeEditComponent.numericFormatting = JSON.parse(
              JSON.stringify(Body.paramsJson)
            );
            this.$refs.describeEditComponent.activeName = "FORMAT";
          }
        } else if (Body.componentType === 27) {
          // 日期与时间操作下面的组件
          await this.$refs.describeEditComponent.params_Lists();
          if (Body.paramsJson.operateType === "TRANS") {
            this.$refs.describeEditComponent.formatConversion = JSON.parse(
              JSON.stringify(Body.paramsJson)
            );
            this.$refs.describeEditComponent.activeTimeName = "TRANS";
            if (Body.paramsJson.type == 1) {
              this.$refs.describeEditComponent.titme1 = "时间戳";
              this.$refs.describeEditComponent.titme2 = "日期";
            } else {
              this.$refs.describeEditComponent.titme1 = "日期";
              this.$refs.describeEditComponent.titme2 = "时间戳";
            }
          } else if (Body.paramsJson.operateType === "DATE") {
            this.$refs.describeEditComponent.activeTimeName = "DATE";
            this.$refs.describeEditComponent.dateOperation = JSON.parse(
              JSON.stringify(Body.paramsJson)
            );
          } else {
            this.$refs.describeEditComponent.timeOperation = JSON.parse(
              JSON.stringify(Body.paramsJson)
            );
            this.$refs.describeEditComponent.activeTimeName = "TIME";
          }
        } else if (Body.componentType === 28) {
          // 控制台日志
          await this.$refs.describeEditComponent.params_Lists();
          this.$refs.describeEditComponent.consoleLogObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
        } else if (Body.componentType === 29) {
          // 自定义代码段
          this.$refs.describeEditComponent.codeHintObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          if (!("formData" in this.$refs.describeEditComponent.codeHintObj)) {
            this.$set(
              this.$refs.describeEditComponent.codeHintObj,
              "formData",
              {
                content: Body.paramsJson.sourceCode,
              }
            );
          }
        } else if (Body.componentType === 30) {
          // 字符串操作
          await this.$refs.describeEditComponent.params_Lists();
          this.$refs.describeEditComponent.stringObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$refs.describeEditComponent.editmethodNamechange(
            this.$refs.describeEditComponent.stringObj.methodName
          );
        } else if (Body.componentType === 31 || Body.componentType === 32) {
          // 短信和邮件通知
          if (Body.componentType === 31) {
            await Promise.all([
              this.$refs.describeEditComponent.findConfigItem("SMS_MODULE"),
              this.$refs.describeEditComponent.findConfigItem("SMS_SIGN_NAME"),
              this.$refs.describeEditComponent.params_Lists(),
            ]);
          } else {
            await Promise.all([
              this.$refs.describeEditComponent.params_Lists(),
              this.$refs.describeEditComponent.findConfigItem("EMAIL_MODULE"),
            ]);
          }
          this.$refs.describeEditComponent.notificationObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          const objone = this.$refs.describeEditComponent.noticeLists.find(
            (item) =>
              item.configItem ===
              this.$refs.describeEditComponent.notificationObj[
                Body.componentType === 31 ? "smsModule" : "emailContent"
              ]
          );
          this.$refs.describeEditComponent.conentValue = objone.configValue;
        } else if (Body.componentType === 33) {
          // 添加一次性定时任务
          await Promise.all([
            this.$refs.describeEditComponent.params_Lists(),
            this.$refs.describeEditComponent.findclassbyType(),
          ]);
          this.$refs.describeEditComponent.yicixingdingshiObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
        } else if (Body.componentType === 34) {
          // 字符串拼接
          await this.$refs.describeEditComponent.params_Lists();
          this.$refs.describeEditComponent.stringConcatenation = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
        } else if (Body.componentType === 35) {
          // HTTP请求
          await this.$refs.describeEditComponent.params_Lists();
          this.$refs.describeEditComponent.requestHttpObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
          this.$refs.describeEditComponent.request_HttpObj =
            this.$refs.describeEditComponent.requestHttpObj;
          if (
            this.$refs.describeEditComponent.requestHttpObj.requestType == "Get"
          ) {
            this.$refs.describeEditComponent.bodyDisabled = true;
          } else {
            this.$refs.describeEditComponent.bodyDisabled = false;
          }
        } else if (Body.componentType === 36) {
          // feign调用
          await this.$refs.describeEditComponent.params_Lists();
          await this.$refs.describeEditComponent.getInterfaceLists();
          this.$refs.describeEditComponent.callComponentObj = JSON.parse(
            JSON.stringify(Body.paramsJson)
          );
        } else if (Body.componentType === 37) {
          // 创建集合
          this.$refs.describeEditComponent.componentsCreateCollection =
            JSON.parse(JSON.stringify(Body.paramsJson));
        }
      });
    },
    collapseChange(activeNames) {
      const obj = this.$parent.$parent.$parent.$parent.titleLists.find(
        (item) =>
          item.name === this.$parent.$parent.$parent.$parent.activeitemName
      );
      if (obj) {
        if (this.isClicktree) {
          obj.active_Name = activeNames;
          console.log(activeNames, "collapseChange");
        } else {
          if (this.activeName === "first") {
            obj.active_sName1 = activeNames;
          } else {
            obj.active_sName2 = activeNames;
          }
        }
      }
      console.log(obj, 9999999);
    },
    handlemethodsEdit(index, item) {
      this.$parent.$parent.$parent.$parent.isClickCom = true;
      this.addBasicObj.isMethodOrBody = "方法";
      this.addBasicObj.isMethodObjOrBody = item;
      this.activeIndex = index;
      // this.handleLook();
      this.handlemarkText("");
    },
    handleEdit3(index1, item) {
      this.addBasicObj.item = item;

      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = index1;
      if (this.classType === "SCHEDULE_TASK") {
        return this.$message({
          message: "当前数据不可编辑",
          type: "warning",
          showClose: true,
        });
      }
      this.diaMethodVisible = true;
      this.$nextTick(() => {
        this.$refs.addMethodassembly.rulecirculateForm = JSON.parse(
          JSON.stringify(item)
        );
        const _returnType_ =
          this.$refs.addMethodassembly.rulecirculateForm.returnType;

        this.handleEditelement_Type(
          _returnType_,
          this.$refs.addMethodassembly.rulecirculateForm,
          "returnType",
          "return_Type",
          this.addMethodReturnType
        );
        this.$refs.addMethodassembly.rulecirculateForm.params?.forEach(
          (item) => {
            const _paramsType_ = item.paramsType;
            this.handleEditelement_Type(
              _paramsType_,
              item,
              "paramsType",
              "params_Type",
              this.leixingLists
            );
          }
        );
        this.$refs.addMethodassembly.title = "编辑方法";
      });
    },
    async handledelete3(index, item) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = index;
      this.$confirm("确定要进行删除操作?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        const res = await delete_method(item.id);
        if (res?.code === 200) {
          this.$message({
            message: "删除成功",
            type: "success",
          });
          this.componentClassjson();
          this.activeIndex = undefined;
        }
      });
    },
    //IF判断，调用方法，创建属性，实例赋值组件中调用方法类名和调用方法名逻辑
    handleEditClazz_NameAndMethod_Name(obj, flag, type) {
      //type只有flag=4的时候才有用
      //flag=1是if判断，flag=2是调用方法，flag=3是创建属性,flag=4是实例赋值组件
      const isHasClazz_Name = Reflect.has(obj, "clazz_Name");
      const isHasMethod_Name = Reflect.has(obj, "method_Name");
      if (isHasClazz_Name && isHasMethod_Name) {
        //低代码平台创建的调用方法类名和调用方法名数据的编辑逻辑处理
        let obj1 = this.$refs.describeEditComponent.methodsLists.find(
          (v) => v.Label_Desc === obj.clazz_Name
        );
        if (obj1) {
          if (flag == 1) {
            this.$set(
              obj,
              "fangfaLists",
              obj1.methodList?.filter(
                (item) =>
                  item.returnType === "Boolean" || item.returnType === "boolean"
              ) ?? []
            );
          } else if (flag == 2) {
            this.$refs.describeEditComponent.fangfaLists = obj1.methodList;
          } else if (flag == 3) {
            this.$refs.describeEditComponent.fangfaLists =
              obj1.methodList?.filter((item) => item.returnType !== "void") ??
              [];
          } else if (flag == 4) {
            this.$set(
              obj,
              "fangfaLists",
              obj1.methodList?.filter((item) => item.returnType === type) ?? []
            );
            console.log(444444444);
          }
        } else {
          if (flag == 1 || flag == 4) {
            this.$set(obj, "fangfaLists", []);
          } else {
            this.$refs.describeEditComponent.fangfaLists = [];
          }
        }
      } else {
        //从外部项目导进来数据中调用方法类名和调用方法名编辑的逻辑处理
        const obj1 = this.$refs.describeEditComponent.methodsLists.find(
          (item) => item.referenceName == obj.clazzName
        );
        if (obj1) {
          this.$set(obj, "clazz_Name", obj1.Label_Desc);
          if (flag == 1) {
            this.$set(
              obj,
              "fangfaLists",
              obj1.methodList?.filter(
                (item) =>
                  item.returnType === "Boolean" || item.returnType === "boolean"
              ) ?? []
            );
          } else if (flag == 2) {
            this.$refs.describeEditComponent.fangfaLists = obj1.methodList;
          } else if (flag == 3) {
            this.$refs.describeEditComponent.fangfaLists =
              obj1.methodList?.filter((item) => item.returnType !== "void") ??
              [];
          } else if (flag == 4) {
            this.$set(
              obj,
              "fangfaLists",
              obj1.methodList?.filter((item) => item.returnType === type) ?? []
            );
          }
          const fangfa_Lists =
            flag == 1 || flag == 4
              ? obj.fangfaLists
              : this.$refs.describeEditComponent.fangfaLists;
          const obj2 = fangfa_Lists.find(
            (item) =>
              item.methodName == obj.methodName &&
              obj.methodParams.length == item.params.length
          );
          if (obj2) {
            this.$set(obj, "method_Name", obj2.Label_Desc);
            obj2.params.forEach((parme1, index1) => {
              obj.methodParams.forEach((parme2, index2) => {
                if (index1 == index2) {
                  this.$set(parme2, "paramsType", parme1.paramsType);
                  console.log(obj2, 4560000);
                }
              });
            });
          } else {
            this.$set(obj, "method_Name", obj.methodName);
            // 和后端商量过下面代码注释掉
            // this.$set(obj, "methodParams", []);
          }
        } else {
          this.$set(obj, "clazz_Name", obj.clazzName);
          if (flag == 1 || flag == 4) {
            this.$set(obj, "fangfaLists", []);
          } else {
            this.$refs.describeEditComponent.fangfaLists = [];
          }
          this.$set(obj, "method_Name", obj.methodName);
          // 和后端商量过下面代码注释掉
          // this.$set(obj, "methodParams", []);
        }
      }
    },
    // 点击编辑封装带有集合元素类型逻辑
    handleEditelement_Type(
      typeValue,
      obj,
      attribute,
      attri_bute,
      list1,
      isAPIlist = false, // 是否是API列表的编辑
      list2 = this.elementLists
    ) {
      let isList = false;
      if (typeValue.includes("<")) {
        isList = typeValue.split("<")[0] == "List";
      }
      if (isList) {
        let indexStart = typeValue.indexOf("<");
        let indexEnd = typeValue.lastIndexOf(">");
        this.$set(
          obj,
          "elementType",
          typeValue.slice(indexStart + 1, indexEnd)
        );
        obj[attribute] = "List";
        const obj1 = list1.find((v) => v.value == obj[attribute]);
        const obj2 = list2.find((v) => v.value == obj.elementType);
        this.$set(obj, attri_bute, obj1.Label_Desc);
        if (obj2) {
          this.$set(obj, "element_Type", obj2.Label_Desc);
        } else {
          this.$set(obj, "element_Type", obj.elementType);
        }
      } else {
        if (isAPIlist) {
          if (typeValue == "Integer") {
            obj[attribute] = "int";
          } else if (["Double", "Long", "Float"].includes(typeValue)) {
            obj[attribute] = typeValue.toLowerCase();
          } else {
            obj[attribute] = typeValue;
          }
        }
        const obj3 = list1.find((v) => v.value == obj[attribute]);
        if (obj3) {
          this.$set(obj, attri_bute, obj3.Label_Desc);
        } else {
          this.$set(obj, attri_bute, obj[attribute]);
        }
        this.$set(obj, "elementType", "");
        this.$set(obj, "element_Type", "");
      }
    },
    handleBeforeClose() {
      this.devavalugedialog = false;
    },
    async findsssAllCanUseVo() {
      this.radioLists = [];
      this.serverForm.radioModel = [];
      let res = null;
      let currentClassId, currentProjectId;
      if (this.isClicktree) {
        currentClassId = this.clicktreeInformation.controller.classId;
        currentProjectId = this.clicktreeInformation.controller.projectId;
        if (this.classType === "CONTROLLER") {
          res = await findCanUseService({ currentProjectId, currentClassId });
        } else if (this.classType === "SERVICE") {
          res = await findCanUsedao({ currentProjectId, currentClassId });
        } else if (this.classType === "TASK") {
          const res1 = await findCanUseService({
            currentProjectId,
            currentClassId,
          });
          const res2 = await findCanUsedao({
            currentProjectId,
            currentClassId,
          });
          if (res1?.code === 200 && res2?.code === 200) {
            res = {
              code: 200,
              data: [...res1.data, ...res2.data],
            };
          }
        }
      } else {
        if (this.activeName === "first") {
          currentProjectId = this.interfaceInformation.controller.projectId;
          currentClassId = this.interfaceInformation.controller.classId;
          res = await findCanUseService({ currentProjectId, currentClassId });
        } else {
          currentProjectId = this.interfaceInformation.service?.projectId;
          currentClassId = this.interfaceInformation.service?.classId;
          res = await findCanUsedao({ currentProjectId, currentClassId });
        }
      }
      if (res?.code === 200) {
        this.radioLists = res.data.map((item) => {
          return {
            classId: item.id,
            serviceChName: item.className,
            classDesc: item.classDesc,
          };
        });
        // this.radioModel = this.radioLists.length
        //   ? this.radioLists[0].serviceChName
        //   : undefined;
      }
    },

    returnClassId() {
      let classId;
      if (this.isClicktree) {
        classId = this.clicktreeInformation.controller.classId;
      } else {
        if (this.activeName === "first") {
          classId = this.interfaceInformation.controller.classId;
        } else {
          classId = this.interfaceInformation.service?.classId;
        }
      }
      return classId;
    },
    returnProjectIdandclassId() {
      let currentClassId, currentProjectId;
      if (this.isClicktree) {
        currentClassId = this.clicktreeInformation.controller.classId;
        currentProjectId = this.clicktreeInformation.controller.projectId;
      } else {
        if (this.activeName === "first") {
          currentClassId = this.interfaceInformation.controller.classId;
          currentProjectId = this.interfaceInformation.controller.projectId;
        } else {
          currentClassId = this.interfaceInformation.service?.classId;
          currentProjectId = this.interfaceInformation.service?.projectId;
        }
      }
      let obj = {
        currentClassId,
        currentProjectId,
        componentIndex: this.commonParmes.componentIndex,
        currentMethodId: this.commonParmes.methodId,
        parentComponentId: this.commonParmes.parentId,
      };
      return obj;
    },
    returnProjectEditIdandclassId() {
      let currentClassId, currentProjectId;
      if (this.isClicktree) {
        currentClassId = this.clicktreeInformation.controller.classId;
        currentProjectId = this.clicktreeInformation.controller.projectId;
      } else {
        if (this.activeName === "first") {
          currentClassId = this.interfaceInformation.controller.classId;
          currentProjectId = this.interfaceInformation.controller.projectId;
        } else {
          currentClassId = this.interfaceInformation.service?.classId;
          currentProjectId = this.interfaceInformation.service?.projectId;
        }
      }
      let obj = {
        currentClassId,
        currentProjectId,
        componentIndex: this.activeObj.componentIndex,
        currentMethodId: this.activeObj.methodId,
        parentComponentId: this.activeObj.parentId,
      };
      return obj;
    },
    async handle_Sure() {
      this.$refs.sreverRef.validate(async (valid) => {
        if (valid) {
          let attributeType = this.serverForm.radioModel.join(",");
          const res = await addClassAttribute(
            attributeType,
            this.returnClassId()
          );
          if (res?.code === 200) {
            this.devavalugedialog = false;
            this.componentClassjson();
          }
        }
      });
    },
    async findAllCanUseVo() {
      let res = await findCanUseVo(+sessionStorage.getItem("developLowCodeId"));
      if (res?.code === 200) {
        const lists = res.data.map((item) => {
          return {
            value: item.className,
            label: item.classDesc
              ? `${item.className} | ${item.classDesc}`
              : item.className,
            Label_Desc: item.classDesc
              ? `${item.className} | ${item.classDesc}`
              : item.className,
          };
        });
        this.disoyongResultLists = [
          {
            value: "String",
            label: "String | 字符串",
            Label_Desc: "String | 字符串",
          },
          ...lists,
        ];
        this.leixingLists = [
          {
            value: "String",
            label: "String | 字符串",
            Label_Desc: "String | 字符串",
          },
          {
            value: "String[]",
            label: "String[] | 字符串数组",
            Label_Desc: "String[] | 字符串数组",
          },
          {
            value: "int",
            label: "int | 整数",
            Label_Desc: "int | 整数",
          },
          {
            value: "int[]",
            label: "int[] | 整数数组",
            Label_Desc: "int[] | 整数数组",
          },
          {
            value: "boolean",
            label: "boolean | 布尔",
            Label_Desc: "boolean | 布尔",
          },
          {
            value: "List",
            label: "List | 集合列表",
            Label_Desc: "List | 集合列表",
          },
          {
            value: "Map",
            label: "Map | 键值对集合",
            Label_Desc: "Map | 键值对集合",
          },
          {
            value: "long",
            label: "long | 长整型",
            Label_Desc: "long | 长整型",
          },
          {
            value: "double",
            label: "double | 双精度浮点数",
            Label_Desc: "double | 双精度浮点数",
          },
          {
            value: "float",
            label: "float | 浮点数",
            Label_Desc: "float | 浮点数",
          },
          ...lists,
        ];
        this.addMethodReturnType = [
          {
            value: "String",
            label: "String | 字符串",
            Label_Desc: "String | 字符串",
          },
          {
            value: "String[]",
            label: "String[] | 字符串数组",
            Label_Desc: "String[] | 字符串数组",
          },
          {
            value: "int",
            label: "int | 整数",
            Label_Desc: "int | 整数",
          },
          {
            value: "long",
            label: "long | 长整型",
            Label_Desc: "long | 长整型",
          },
          {
            value: "int[]",
            label: "int[] | 整数数组",
            Label_Desc: "int[] | 整数数组",
          },
          {
            value: "boolean",
            label: "boolean | 布尔",
            Label_Desc: "boolean | 布尔",
          },
          {
            value: "List",
            label: "List | 集合列表",
            Label_Desc: "List | 集合列表",
          },
          {
            value: "Map",
            label: "Map | 键值对集合",
            Label_Desc: "Map | 键值对集合",
          },
          {
            value: "void",
            label: "void | 无返回值",
            Label_Desc: "void | 无返回值",
          },
          ...lists,
        ];
        this.create_InstanceClassLists = lists;
        const parmesLists = [
          {
            value: "String",
            label: "String | 字符串",
            Label_Desc: "String | 字符串",
          },
          {
            value: "Boolean",
            label: "Boolean | 布尔",
            Label_Desc: "Boolean | 布尔",
          },
          {
            value: "Integer",
            label: "Integer | 整数",
            Label_Desc: "Integer | 整数",
          },
          ...lists,
        ];
        this.projectdatebaseLists(parmesLists);
      }
    },
    async projectdatebaseLists(parmesLists) {
      this.elementLists = [];
      const res = await projectdatebaseLists(
        +sessionStorage.getItem("developLowCodeId")
      );
      if (res?.code === 200) {
        const lists = res.data.map((item) => {
          return {
            value: item.className,
            label: item.classDesc
              ? `${item.className} | ${item.classDesc}`
              : item.className,
            Label_Desc: item.classDesc
              ? `${item.className} | ${item.classDesc}`
              : item.className,
          };
        });
        this.elementLists = [
          ...parmesLists,
          ...lists,
          {
            value: "+",
            label: "+",
            Label_Desc: "+",
          },
        ];
        this.create_InstanceClassLists = [
          ...this.create_InstanceClassLists,
          ...lists,
          {
            value: "+",
            label: "+",
            Label_Desc: "+",
          },
        ];
        this.leixingLists = [
          ...this.leixingLists,
          ...lists,
          {
            value: "+",
            label: "+",
            Label_Desc: "+",
          },
        ];
        this.disoyongResultLists = [
          ...this.disoyongResultLists,
          ...lists,
          {
            value: "+",
            label: "+",
            Label_Desc: "+",
          },
        ];
        this.addMethodReturnType = [
          ...this.addMethodReturnType,
          ...lists,
          {
            value: "+",
            label: "+",
            Label_Desc: "+",
          },
        ];
        const arrayLists = JSON.parse(JSON.stringify(this.leixingLists));
        this.leixingOnlyLists = arrayLists.filter(
          (item) => item.value != "List"
        );
      }
    },
    async listModulePackage() {
      this.packageLists = [];
      const res = await listModulePackage(
        +sessionStorage.getItem("developLowCodeId"),
        this.formData.moduleId
      );
      if (res?.code === 200) {
        this.packageLists = res.data;
      }
    },
    async handleBlur(value) {
      const res = await requestNameExist(
        value,
        +sessionStorage.getItem("developLowCodeId")
      );
      if (res?.code === 200) {
        if (res.data) {
          this.$message({
            message: "接口名已存在，请从新输入",
            type: "warning",
            showClose: true,
          });
          this.formData.requestName = "";
          return true;
        }
      }
    },
    handleeditEdit() {
      if (!this.isyuanmaShow) {
        if (this.titleName === "编辑此类") {
          this.titleName = "查看此类";
          this.isbtn = true;
        } else {
          this.titleName = "编辑此类";
          this.isbtn = false;
        }
      }
      this.isyuanmaShow = false;
      this.generateClassCode();
    },
    async handleshowLook() {
      if (this.returnClassId()) {
        this.isyuanmaShow = true;
        this.generateClassCode();
      }
    },
    async generateClassCode() {
      try {
        this.yuanmaLoading = true;
        const res = await generateClassCode(this.returnClassId());
        this.yuanmaLoading = false;
        if (res?.code === 200) {
          this.allSourceCode.content = res.data;
          // this.$nextTick(() => {
          //   this.$refs.codemirrorvue2.markText(
          //     "org.springframework.beans.factory.annotation.Autowired"
          //   );
          // });
        }
      } catch (err) {
        this.yuanmaLoading = false;
      }
    },
    handleService() {
      this.devavalugedialog = true;
      this.findsssAllCanUseVo();
    },
    handleDelete(index) {
      this.formData.requestParams.splice(index, 1);
    },
    handleAddParmes() {
      this.formData.requestParams.push({
        paramsType: "String",
      });
    },
    handlemMethodsClick(item, index) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = index;
      // const res=await showServiceImpl()
      // if(res?.code===200){
      //   this.componentClassjson();
      // }
    },
    async handleClick2(item) {
      if (sessionStorage.getItem("activeState") === "创建属性") {
        sessionStorage.setItem("isCreateAttribute", "是");
      }
      this.diaVisible = true;
      this.commonParmes.methodId = item.id;
      this.commonParmes.parentId = item.id;
      this.commonParmes.componentIndex = 0;
    },
    recursion(methodBody, Body) {
      const obj = methodBody.find((item2) => item2.id === Body.parentId);
      if (obj) {
        if (obj.componentType == 3 || obj.componentType == 2) {
          this.diaVisible = true;
        } else {
          this.recursion(methodBody, obj);
        }
      } else {
        this.$message({
          message: "当前位置不能添加该组件",
          type: "warning",
          showClose: true,
        });
        return true;
      }
    },
    handleClick3(item, Body, flag, index, methodBody) {
      if (sessionStorage.getItem("activeState") === "创建属性") {
        sessionStorage.setItem("isCreateAttribute", "是");
      }
      this.diaVisible = true;
      this.commonParmes.methodId = item.id;
      this.commonParmes.componentIndex = Body.componentIndex + 1;
      if (flag) {
        this.commonParmes.parentId = Body.parentId;
        if ([1, 16].includes(Body.componentType)) {
          let number = Body.componentIndex + 1;
          let idx = index + 1;
          while (
            methodBody[idx] &&
            (methodBody[idx].componentType === 16 ||
              methodBody[idx].componentType === 17)
          ) {
            number++;
            idx++;
          }
          this.commonParmes.componentIndex = number;
        }
      } else {
        if (this.isContains.includes(Body.componentType)) {
          this.commonParmes.componentIndex = 0;
          this.commonParmes.parentId = Body.id;
        } else {
          this.commonParmes.parentId = Body.parentId;
        }
      }
    },

    handleClick5(indx1, indx3, idx, id, methodId) {
      this.$parent.$parent.$parent.$parent.isClickCom = false;
      this.activeIndex = idx;
      this.$confirm("确定要进行删除操作?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const res = await deleteComponent(id, methodId);
          if (res?.code === 200) {
            this.$message({
              message: "删除成功",
              type: "success",
            });
            if (this.isClicktree) {
              this.clicktreeInformation.controller.methods[
                indx1
              ].methodBody.splice(indx3, 1);
            } else {
              if (this.activeName === "first") {
                this.interfaceInformation.controller.methods[
                  indx1
                ].methodBody.splice(indx3, 1);
              } else {
                this.interfaceInformation.service?.methods[
                  indx1
                ].methodBody.splice(indx3, 1);
              }
            }
            this.generateClassCode();
            this.handlemarkText("");
            const obj = this.$parent.$parent.$parent.$parent.titleLists.find(
              (item) =>
                item.name ===
                this.$parent.$parent.$parent.$parent.activeitemName
            );
            if (obj) {
              if (this.isClicktree) {
                obj.highlightActive = null;
              } else {
                if (this.activeName === "first") {
                  obj.activeController = null;
                } else {
                  obj.activeServer = null;
                }
              }
            }
          }
        })
        .catch(() => {
          // this.activeIndex=undefined
        });
    },
    onSave() {
      this.$refs["dialogForm"].validate(async (valid) => {
        if (valid) {
          let res = null;
          if (this.btnTitle == "重新生成接口代码") {
            if (this.formData.requestName !== this.formOldData.requestName) {
              const flag = await this.handleBlur(this.formData.requestName);
              if (flag) return;
            }
            const parmes = JSON.parse(JSON.stringify(this.formData));
            parmes.projectId = +sessionStorage.getItem("developLowCodeId");
            if (this.formData.returnType === "List") {
              parmes.returnType = `${this.formData.returnType}<${this.formData.elementType}>`;
            }
            this.$confirm("将重新生成接口类代码，请谨慎操作?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
            }).then(async () => {
              res = await update_generate_interface(parmes.id, {
                newVo: parmes,
                oldVo: this.formOldData,
              });
              if (res?.code === 200) {
                this.formOldData = parmes;
                this.$message({
                  message: "更新成功",
                  type: "success",
                });
                this.isapi = false;
                this.interfaceInformation = JSON.parse(
                  JSON.stringify(res.data)
                );
                this.interface_Information = JSON.parse(
                  JSON.stringify(res.data)
                );
                this.Informationfengzhuang(this.interfaceInformation);
                // this.$parent.$parent.$parent.$parent.handleadFangfaAdd(
                //   "addfangfa"
                // );
                console.log(
                  this.classType,
                  this.activeName,
                  "重新生成接口代码"
                );
                if (!this.interfaceInformation.service) {
                  this.activeName = "first";
                }
                if (this.activeName === "first") {
                  this.classType =
                    this.interfaceInformation.controller?.classType;
                } else {
                  this.classType = this.interfaceInformation.service?.classType;
                }

                this.$parent.$parent.$parent.$parent.activeitemName = `${parmes.requestChName}接口逻辑:${parmes.requestName}`;
                this.$parent.$parent.$parent.$parent.activeState = `${parmes.requestChName}接口逻辑:${parmes.requestName}`;
                this.$parent.$parent.$parent.$parent.isaddTitleLists(
                  `${parmes.requestChName}接口逻辑:${parmes.requestName}`,
                  this.interfaceInformation
                );
                this.$parent.$parent.$parent.$parent.moduleModetTreeList();
                this.getList();
                this.handleLook();
              }
            });
          } else {
            const flag = await this.handleBlur(this.formData.requestName);
            if (flag) return;
            const parmes = JSON.parse(JSON.stringify(this.formData));
            parmes.projectId = +sessionStorage.getItem("developLowCodeId");
            if (this.formData.returnType === "List") {
              parmes.returnType = `${this.formData.returnType}<${this.formData.elementType}>`;
            }
            res = await GenerateInterface(parmes);
            if (res?.code === 200) {
              this.$message({
                message: "新增成功",
                type: "success",
              });
              this.interfaceInformation = JSON.parse(JSON.stringify(res.data));
              this.interface_Information = JSON.parse(JSON.stringify(res.data));
              this.Informationfengzhuang(this.interfaceInformation);
              this.isapi = false;
              this.$parent.$parent.$parent.$parent.activeitemName = `${parmes.requestChName}接口逻辑:${parmes.requestName}`;
              this.$parent.$parent.$parent.$parent.activeState = `${parmes.requestChName}接口逻辑:${parmes.requestName}`;
              this.$parent.$parent.$parent.$parent.isaddTitleLists(
                `${parmes.requestChName}接口逻辑:${parmes.requestName}`,
                this.interfaceInformation
              );
              console.log(this.classType, this.activeName, "生成接口基础信息");
              // this.$parent.$parent.$parent.$parent.handleadFangfaAdd(
              //   "addfangfa"
              // );
              if (!this.interfaceInformation.service) {
                this.activeName = "first";
              }
              if (this.activeName === "first") {
                this.classType =
                  this.interfaceInformation.controller?.classType;
              } else {
                this.classType = this.interfaceInformation.service?.classType;
              }
              this.$parent.$parent.$parent.$parent.moduleModetTreeList();
              this.getList();
              this.handleLook();
            }
          }
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
.chosen {
  // color: red;
  color: rgb(255, 186, 0);
}
.mgl10 {
  margin-left: 10px;
}
.serviceBox {
  overflow: auto;
  max-height: 380px;
}
.serviceBox ::v-deep .el-radio-group {
  display: flex;
  flex-wrap: wrap;
  .el-radio {
    margin-top: 10px;
  }
}
.is_Clicktree {
  margin-top: 10px;
  padding-left: 10px;
  padding-top: 10px;
  border: 1px solid #dfe4ed;
  flex: 1;
  height: calc(-204px + 100vh);
  overflow: auto;
}
.isnot_Clicktree {
  padding-left: 10px;
  padding-top: 10px;
  border: 1px solid #dfe4ed;
  height: calc(-248px + 100vh);
  overflow: auto;
}
.elCollapseStyle {
  .collapse-title {
    width: 90%;
    display: flex;
    align-items: center;
    margin: 5px 0;
    flex: 1 0 90%;
    order: 1;
    font-size: 14px;
  }
  // ::v-deep .el-collapse-item__header:nth-first {
  //   border-top: 1px solid #e6ebf5;
  // }
  .el-collapse {
    border: none;
  }
  ::v-deep .el-collapse-item__content {
    padding-bottom: 0;
    font-size: 14px;
  }
}
.lipsClass {
  // max-width: 75%;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
</style>
